summaryrefslogtreecommitdiff
path: root/bfd/elfxx-sparc.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-02-04 09:16:36 +0000
committerNick Clifton <nickc@redhat.com>2010-02-04 09:16:36 +0000
commitc48cc8a51e9c991bdfc476a01d014465cc5dbb51 (patch)
tree3a142d5ccd02d6a1a188783813b87c5dc587708c /bfd/elfxx-sparc.c
parent87f8f5b2cdc4579e5e3b6dbee98075e33f99baa9 (diff)
downloadbinutils-redhat-c48cc8a51e9c991bdfc476a01d014465cc5dbb51.tar.gz
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add
entries for other architectures. (struct elf_link_hash_table): Add hash_table_id field. (elf_hash_table_id): New accessor macro. * elflink.c (_bfd_elf_link_hash_table_init): Add target_id parameter. * elf-m10300.c (elf32_mn10300_hash_table): Check table id before returning cast pointer. (elf32_mn10300_link_hash_table_create): Identify new table as containing MN10300 extensions. (mn10300_elf_relax_section): Check pointer returned by elf32_mn10300_hash_table. * elf32-arm.c: Likewise, except using ARM extensions. * elf32-avr.c: Likewise, except using AVR extensions. * elf32-bfin.c: Likewise, except using BFIN extensions. * elf32-cris.c: Likewise, except using CRIS extensions. * elf32-frv.c: Likewise, except using FRV extensions. * elf32-hppa.c: Likewise, except using HPPA32 extensions. * elf32-i386.c: Likewise, except using I386 extensions. * elf32-lm32.c: Likewise, except using LM32 extensions. * elf32-m32r.c: Likewise, except using M32RM extensions. * elf32-m68hc11.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions. * elf32-m68k.c: Likewise, except using M68K extensions. * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions. * elf32-ppc.c: Likewise, except using PPC32 extensions. * elf32-s390.c: Likewise, except using S390 extensions. * elf32-sh.c: Likewise, except using SH extensions. * elf32-spu.c: Likewise, except using SPU extensions. * elf32-xtensa.c: Likewise, except using XTENSA extensions. * elf64-alpha.c: Likewise, except using ALPHA extensions. * elf64-hppa.c: Likewise, except using HPPA64 extensions. * elf64-ppc.c: Likewise, except using PPC64 extensions. * elf64-s390.c: Likewise, except using S390 extensions. * elf64-x86-64.c: Likewise, except using X86_64 extensions. * elfxx-ia64.c: Likewise, except using IA64 extensions. * elfxx-mips.c: Likewise, except using MIPS extensions. * elfxx-sparc.c: Likewise, except using SPARC extensions. * elfxx-sparc.h: Likewise, except using SPARC extensions. * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete redundant structure. (elf32_cr16_hash_table): Delete unused macro. (elf32_cr16_link_hash_traverse): Delete unused macro. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-vax.c: Likewise. * elf64-sh64.c: Likewise. * emultempl/alphaelf.em: Update value expected from elf_object_id. * emultempl/hppaelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise.
Diffstat (limited to 'bfd/elfxx-sparc.c')
-rw-r--r--bfd/elfxx-sparc.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 06ae25e3a4..73284db645 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1,5 +1,5 @@
/* SPARC-specific support for ELF
- Copyright 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -523,13 +523,13 @@ struct _bfd_sparc_elf_obj_tdata
#define is_sparc_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == SPARC_ELF_TDATA)
+ && elf_object_id (bfd) == SPARC_ELF_DATA)
bfd_boolean
_bfd_sparc_elf_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct _bfd_sparc_elf_obj_tdata),
- SPARC_ELF_TDATA);
+ SPARC_ELF_DATA);
}
static void
@@ -875,7 +875,8 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd)
}
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
- sizeof (struct _bfd_sparc_elf_link_hash_entry)))
+ sizeof (struct _bfd_sparc_elf_link_hash_entry),
+ SPARC_ELF_DATA))
{
free (ret);
return NULL;
@@ -896,6 +897,8 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
return FALSE;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
BFD_ASSERT (htab->sgot != NULL);
@@ -926,6 +929,8 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
struct _bfd_sparc_elf_link_hash_table *htab;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (!htab->sgot && !create_got_section (dynobj, info))
return FALSE;
@@ -1093,6 +1098,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
return TRUE;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
local_got_offsets = elf_local_got_offsets (abfd);
@@ -1565,6 +1571,7 @@ _bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
elf_section_data (sec)->local_dynrel = NULL;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
@@ -1710,6 +1717,7 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
asection *s;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* Make sure we know what is going on here. */
BFD_ASSERT (htab->elf.dynobj != NULL
@@ -1851,6 +1859,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
info = (struct bfd_link_info *) inf;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0)
@@ -2144,6 +2153,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
bfd *ibfd;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -2511,6 +2521,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
bfd_boolean is_vxworks_tls;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
@@ -3606,6 +3617,8 @@ sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Rela rela;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (info->shared)
{
plt_entry = sparc_vxworks_shared_plt_entry;
@@ -3694,6 +3707,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
const struct elf_backend_data *bed;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj;
bed = get_elf_backend_data (output_bfd);
@@ -3872,6 +3886,7 @@ sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
bfd_boolean abi_64_p;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
bed = get_elf_backend_data (output_bfd);
dynsize = bed->s->sizeof_dyn;
dynconend = sdyn->contents + sdyn->size;
@@ -3963,6 +3978,7 @@ sparc_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info)
bfd_byte *loc;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* Calculate the absolute value of _GLOBAL_OFFSET_TABLE_. */
got_base = (htab->elf.hgot->root.u.def.section->output_section->vma
@@ -4038,6 +4054,8 @@ sparc_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info)
unsigned int i;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
for (i = 0; i < ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); i++)
bfd_put_32 (output_bfd, sparc_vxworks_shared_plt0_entry[i],
htab->splt->contents + i * 4);
@@ -4051,6 +4069,7 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
struct _bfd_sparc_elf_link_hash_table *htab;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");