diff options
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r-- | bfd/bfd.c | 108 |
1 files changed, 56 insertions, 52 deletions
@@ -649,7 +649,7 @@ union _bfd_doprnt_args }; /* This macro and _bfd_doprnt taken from libiberty _doprnt.c, tidied a - little and extended to handle '%A', '%B' and positional parameters. + little and extended to handle '%pA', '%pB' and positional parameters. 'L' as a modifer for integer formats is used for bfd_vma and bfd_size_type args, which vary in size depending on BFD configuration. */ @@ -866,53 +866,55 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args) PRINT_TYPE (char *, p); break; case 'p': - PRINT_TYPE (void *, p); - break; - case 'A': - { - asection *sec; - bfd *abfd; - const char *group = NULL; - struct coff_comdat_info *ci; - - sec = (asection *) args[arg_no].p; - if (sec == NULL) - /* Invoking %A with a null section pointer is an - internal error. */ - abort (); - abfd = sec->owner; - if (abfd != NULL - && bfd_get_flavour (abfd) == bfd_target_elf_flavour - && elf_next_in_group (sec) != NULL - && (sec->flags & SEC_GROUP) == 0) - group = elf_group_name (sec); - else if (abfd != NULL - && bfd_get_flavour (abfd) == bfd_target_coff_flavour - && (ci = bfd_coff_get_comdat_section (sec->owner, - sec)) != NULL) - group = ci->name; - if (group != NULL) - result = fprintf (stream, "%s[%s]", sec->name, group); - else - result = fprintf (stream, "%s", sec->name); - } - break; - case 'B': - { - bfd *abfd; - - abfd = (bfd *) args[arg_no].p; - if (abfd == NULL) - /* Invoking %B with a null bfd pointer is an - internal error. */ - abort (); - else if (abfd->my_archive - && !bfd_is_thin_archive (abfd->my_archive)) - result = fprintf (stream, "%s(%s)", - abfd->my_archive->filename, abfd->filename); - else - result = fprintf (stream, "%s", abfd->filename); - } + if (*ptr == 'A') + { + asection *sec; + bfd *abfd; + const char *group = NULL; + struct coff_comdat_info *ci; + + ptr++; + sec = (asection *) args[arg_no].p; + if (sec == NULL) + /* Invoking %pA with a null section pointer is an + internal error. */ + abort (); + abfd = sec->owner; + if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && elf_next_in_group (sec) != NULL + && (sec->flags & SEC_GROUP) == 0) + group = elf_group_name (sec); + else if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_coff_flavour + && (ci = bfd_coff_get_comdat_section (sec->owner, + sec)) != NULL) + group = ci->name; + if (group != NULL) + result = fprintf (stream, "%s[%s]", sec->name, group); + else + result = fprintf (stream, "%s", sec->name); + } + else if (*ptr == 'B') + { + bfd *abfd; + + ptr++; + abfd = (bfd *) args[arg_no].p; + if (abfd == NULL) + /* Invoking %pB with a null bfd pointer is an + internal error. */ + abort (); + else if (abfd->my_archive + && !bfd_is_thin_archive (abfd->my_archive)) + result = fprintf (stream, "%s(%s)", + abfd->my_archive->filename, + abfd->filename); + else + result = fprintf (stream, "%s", abfd->filename); + } + else + PRINT_TYPE (void *, p); break; default: abort(); @@ -1094,9 +1096,11 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args) } break; case 's': + arg_type = Ptr; + break; case 'p': - case 'A': - case 'B': + if (*ptr == 'A' || *ptr == 'B') + ptr++; arg_type = Ptr; break; default: @@ -1116,8 +1120,8 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args) /* This is the default routine to handle BFD error messages. Like fprintf (stderr, ...), but also handles some extra format specifiers. - %A section name from section. For group components, prints group name too. - %B file name from bfd. For archive components, prints archive too. + %pA section name from section. For group components, prints group name too. + %pB file name from bfd. For archive components, prints archive too. Beware: Only supports a maximum of 9 format arguments. */ |