From: Nick Clifton Date: Sat, 11 Aug 2001 16:48:15 +0000 (+0000) Subject: replace direct invocation og elf vma print functions with indirect invocation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e771d61a32b75417be0b4f7c3efbe2e3691056d;p=binutils-gdb.git replace direct invocation og elf vma print functions with indirect invocation --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 52648014be9..fc32b09ff3b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,23 @@ +2001-08-11 Nick Clifton + + * elf-bfd.h (struct elf_backend_data): Add new fields + 'elf_backend_sprintf_vma' and 'elf_backend_fprintf_vma'. + (bfd_elf_sprintf_vma): Rename function prototype to + '_bfd_elf_sprintf_vma'. + (bfd_elf_fprintf_vma): Rename function prototype to + '_bfd_elf_fprintf_vma'. + * bfd.c (bfd_sprintf_vma): Do not invoke bfd_elf_sprintf_vma + directly, instead indirect via the elf_backend_data structure. + (bfd_fprintf_vma): Do not invoke bfd_elf_fprintf_vma directly, + instead indirect via the elf_backend_data structure. + * elf.c (bfd_elf_sprintf_vma): Rename to _bfd_elf_sprintf_vma. + (bfd_elf_fprintf_vma): Rename to _bfd_elf_fprintf_vma. + * elfxx-target.h (elf_backend_sprintf_vma): Initialise if not + already defined. + (elf_backend_fprintf_vma): Initialise if not already defined. + (struct elf_backend_data): Initialise the + elf_backend_sprintf_vma and elf_backend_fprintf_vma fields. + 2001-08-10 Andreas Jaeger * elf64-sparc.c: Add missing prototypes. diff --git a/bfd/bfd.c b/bfd/bfd.c index 1a0078341b9..ca50aac13e7 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1270,7 +1270,7 @@ bfd_sprintf_vma (abfd, buf, value) bfd_vma value; { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) - bfd_elf_sprintf_vma (abfd, buf, value); + get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value); else sprintf_vma (buf, value); } @@ -1282,7 +1282,7 @@ bfd_fprintf_vma (abfd, stream, value) bfd_vma value; { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) - bfd_elf_fprintf_vma (abfd, stream, value); + get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value); else fprintf_vma ((FILE *) stream, value); } diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index b0e20ea9aa6..1d684328d2e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -636,6 +636,10 @@ struct elf_backend_data note is found in a core file. */ boolean (*elf_backend_grok_psinfo) PARAMS ((bfd *, Elf_Internal_Note *)); + /* Functions to print VMAs. Special code to handle 64 bit ELF files. */ + void (* elf_backend_sprintf_vma) PARAMS ((bfd *, char *, bfd_vma)); + void (* elf_backend_fprintf_vma) PARAMS ((bfd *, PTR, bfd_vma)); + /* The swapping table to use when dealing with ECOFF information. Used for the MIPS ELF .mdebug section. */ const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; @@ -999,8 +1003,8 @@ extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *, #define bfd_elf32_print_symbol bfd_elf_print_symbol #define bfd_elf64_print_symbol bfd_elf_print_symbol -extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma)); -extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma)); +extern void _bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma)); +extern void _bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma)); extern unsigned long bfd_elf_hash PARAMS ((const char *)); diff --git a/bfd/elf.c b/bfd/elf.c index a6332e24196..56b7926fb92 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5996,7 +5996,7 @@ bfd_get_elf_phdrs (abfd, phdrs) } void -bfd_elf_sprintf_vma (abfd, buf, value) +_bfd_elf_sprintf_vma (abfd, buf, value) bfd *abfd ATTRIBUTE_UNUSED; char *buf; bfd_vma value; @@ -6027,7 +6027,7 @@ bfd_elf_sprintf_vma (abfd, buf, value) } void -bfd_elf_fprintf_vma (abfd, stream, value) +_bfd_elf_fprintf_vma (abfd, stream, value) bfd *abfd ATTRIBUTE_UNUSED; PTR stream; bfd_vma value; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 2b86aacabde..2d0970e449a 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -338,6 +338,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef elf_backend_grok_psinfo #define elf_backend_grok_psinfo NULL #endif +#ifndef elf_backend_sprintf_vma +#define elf_backend_sprintf_vma _bfd_elf_sprintf_vma +#endif +#ifndef elf_backend_fprintf_vma +#define elf_backend_fprintf_vma _bfd_elf_fprintf_vma +#endif /* Previously, backends could only use SHT_REL or SHT_RELA relocation sections, but not both. They defined USE_REL to indicate SHT_REL @@ -423,6 +429,8 @@ static CONST struct elf_backend_data elfNN_bed = elf_backend_count_relocs, elf_backend_grok_prstatus, elf_backend_grok_psinfo, + elf_backend_sprintf_vma, + elf_backend_fprintf_vma, elf_backend_ecoff_debug_swap, ELF_MACHINE_ALT1, ELF_MACHINE_ALT2,