replace direct invocation og elf vma print functions with indirect invocation

This commit is contained in:
Nick Clifton 2001-08-11 16:48:15 +00:00
parent f72c8c98df
commit 4e771d61a3
5 changed files with 38 additions and 6 deletions

View File

@ -1,3 +1,23 @@
2001-08-11 Nick Clifton <nickc@cambridge.redhat.com>
* 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 <aj@suse.de>
* elf64-sparc.c: Add missing prototypes.

View File

@ -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);
}

View File

@ -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 *));

View File

@ -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;

View File

@ -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,