* elf-bfd.h (struct elf_backend_data): Delete elf_backend_sprintf_vma
and elf_backend_fprintf_vma. (_bfd_elf_sprintf_vma, _bfd_elf_fprintf_vma): Delete. * elf.c (_bfd_elf_sprintf_vma, _bfd_elf_fprintf_vma): Delete. * elfxx-target.h (elf_backend_sprintf_vma): Don't define. (elf_backend_fprintf_vma): Likewise. (elfNN_bed): Don't init removed fields. * bfd.c (is32bit): New function. (bfd_sprintf_vma, bfd_fprintf_vma): Use the above.
This commit is contained in:
parent
ec56d5c0f6
commit
01a3c21322
@ -1,3 +1,15 @@
|
||||
2007-09-12 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elf-bfd.h (struct elf_backend_data): Delete elf_backend_sprintf_vma
|
||||
and elf_backend_fprintf_vma.
|
||||
(_bfd_elf_sprintf_vma, _bfd_elf_fprintf_vma): Delete.
|
||||
* elf.c (_bfd_elf_sprintf_vma, _bfd_elf_fprintf_vma): Delete.
|
||||
* elfxx-target.h (elf_backend_sprintf_vma): Don't define.
|
||||
(elf_backend_fprintf_vma): Likewise.
|
||||
(elfNN_bed): Don't init removed fields.
|
||||
* bfd.c (is32bit): New function.
|
||||
(bfd_sprintf_vma, bfd_fprintf_vma): Use the above.
|
||||
|
||||
2007-09-11 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* archures.c: Add bfd_mach_mcf_isa_c_nodiv,
|
||||
|
54
bfd/bfd.c
54
bfd/bfd.c
@ -1376,31 +1376,51 @@ bfd_record_phdr (bfd *abfd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
bfd_sprintf_vma (bfd *abfd, char *buf, bfd_vma value)
|
||||
#ifdef BFD64
|
||||
/* Return true iff this target is 32-bit. */
|
||||
|
||||
static bfd_boolean
|
||||
is32bit (bfd *abfd)
|
||||
{
|
||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||
get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value);
|
||||
else
|
||||
sprintf_vma (buf, value);
|
||||
{
|
||||
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
|
||||
return bed->s->elfclass == ELFCLASS32;
|
||||
}
|
||||
|
||||
/* For non-ELF, make a guess based on the target name. */
|
||||
return (strstr (bfd_get_target (abfd), "64") == NULL
|
||||
&& strcmp (bfd_get_target (abfd), "mmo") != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* bfd_sprintf_vma and bfd_fprintf_vma display an address in the
|
||||
target's address size. */
|
||||
|
||||
void
|
||||
bfd_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value)
|
||||
{
|
||||
#ifdef BFD64
|
||||
if (is32bit (abfd))
|
||||
{
|
||||
sprintf (buf, "%08lx", (unsigned long) value & 0xffffffff);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
sprintf_vma (buf, value);
|
||||
}
|
||||
|
||||
void
|
||||
bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value)
|
||||
bfd_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value)
|
||||
{
|
||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||
get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
|
||||
#ifdef BFD64
|
||||
/* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
|
||||
value, but really we want to display the address in the target's
|
||||
address size. Since we do not have a field in the bfd structure
|
||||
to tell us this, we take a guess, based on the target's name. */
|
||||
else if (strstr (bfd_get_target (abfd), "64") == NULL
|
||||
&& strcmp (bfd_get_target (abfd), "mmo") != 0)
|
||||
fprintf ((FILE *) stream, "%08lx", (unsigned long) (value & 0xffffffff));
|
||||
if (is32bit (abfd))
|
||||
{
|
||||
fprintf ((FILE *) stream, "%08lx", (unsigned long) value & 0xffffffff);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
fprintf_vma ((FILE *) stream, value);
|
||||
fprintf_vma ((FILE *) stream, value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -953,12 +953,6 @@ struct elf_backend_data
|
||||
char *(*elf_backend_write_core_note)
|
||||
(bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
|
||||
|
||||
/* Functions to print VMAs. Special code to handle 64 bit ELF files. */
|
||||
void (* elf_backend_sprintf_vma)
|
||||
(bfd *, char *, bfd_vma);
|
||||
void (* elf_backend_fprintf_vma)
|
||||
(bfd *, void *, bfd_vma);
|
||||
|
||||
/* This function returns class of a reloc type. */
|
||||
enum elf_reloc_type_class (*elf_backend_reloc_type_class)
|
||||
(const Elf_Internal_Rela *);
|
||||
@ -1552,11 +1546,6 @@ extern bfd_boolean _bfd_elf_print_private_bfd_data
|
||||
extern void bfd_elf_print_symbol
|
||||
(bfd *, void *, asymbol *, bfd_print_symbol_type);
|
||||
|
||||
extern void _bfd_elf_sprintf_vma
|
||||
(bfd *, char *, bfd_vma);
|
||||
extern void _bfd_elf_fprintf_vma
|
||||
(bfd *, void *, bfd_vma);
|
||||
|
||||
extern unsigned int _bfd_elf_eh_frame_address_size
|
||||
(bfd *, asection *);
|
||||
extern bfd_byte _bfd_elf_encode_eh_address
|
||||
|
57
bfd/elf.c
57
bfd/elf.c
@ -8415,63 +8415,6 @@ bfd_get_elf_phdrs (bfd *abfd, void *phdrs)
|
||||
return num_phdrs;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value)
|
||||
{
|
||||
#ifdef BFD64
|
||||
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
|
||||
|
||||
i_ehdrp = elf_elfheader (abfd);
|
||||
if (i_ehdrp == NULL)
|
||||
sprintf_vma (buf, value);
|
||||
else
|
||||
{
|
||||
if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
|
||||
{
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
sprintf (buf, "%016lx", value);
|
||||
#else
|
||||
sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
|
||||
_bfd_int64_low (value));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
|
||||
}
|
||||
#else
|
||||
sprintf_vma (buf, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value)
|
||||
{
|
||||
#ifdef BFD64
|
||||
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
|
||||
|
||||
i_ehdrp = elf_elfheader (abfd);
|
||||
if (i_ehdrp == NULL)
|
||||
fprintf_vma ((FILE *) stream, value);
|
||||
else
|
||||
{
|
||||
if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
|
||||
{
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
fprintf ((FILE *) stream, "%016lx", value);
|
||||
#else
|
||||
fprintf ((FILE *) stream, "%08lx%08lx",
|
||||
_bfd_int64_high (value), _bfd_int64_low (value));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
fprintf ((FILE *) stream, "%08lx",
|
||||
(unsigned long) (value & 0xffffffff));
|
||||
}
|
||||
#else
|
||||
fprintf_vma ((FILE *) stream, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
enum elf_reloc_type_class
|
||||
_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
@ -494,12 +494,6 @@
|
||||
#ifndef elf_backend_write_core_note
|
||||
#define elf_backend_write_core_note 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
|
||||
#ifndef elf_backend_reloc_type_class
|
||||
#define elf_backend_reloc_type_class _bfd_elf_reloc_type_class
|
||||
#endif
|
||||
@ -676,8 +670,6 @@ static struct elf_backend_data elfNN_bed =
|
||||
elf_backend_grok_prstatus,
|
||||
elf_backend_grok_psinfo,
|
||||
elf_backend_write_core_note,
|
||||
elf_backend_sprintf_vma,
|
||||
elf_backend_fprintf_vma,
|
||||
elf_backend_reloc_type_class,
|
||||
elf_backend_discard_info,
|
||||
elf_backend_ignore_discarded_relocs,
|
||||
|
Loading…
Reference in New Issue
Block a user