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.
+2010-02-03 Nick Clifton <nickc@redhat.com>
+
+ * 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.
+
2010-02-03 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (struct plt_entry): Move earlier in file.
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Cygnus Support.
bfd_boolean table;
};
+/* Enum used to identify target specific extensions to the elf_obj_tdata
+ and elf_link_hash_table structures. Note the enums deliberately start
+ from 1 so that we can detect an uninitialized field. The generic value
+ is last so that additions to this enum do not need to modify more than
+ one line. */
+enum elf_target_id
+{
+ ALPHA_ELF_DATA = 1,
+ ARM_ELF_DATA,
+ AVR_ELF_DATA,
+ BFIN_ELF_DATA,
+ CRIS_ELF_DATA,
+ FRV_ELF_DATA,
+ HPPA32_ELF_DATA,
+ HPPA64_ELF_DATA,
+ I386_ELF_DATA,
+ IA64_ELF_DATA,
+ LM32_ELF_DATA,
+ M32R_ELF_DATA,
+ M68HC11_ELF_DATA,
+ M68K_ELF_DATA,
+ MICROBLAZE_ELF_DATA,
+ MIPS_ELF_DATA,
+ MN10300_ELF_DATA,
+ PPC32_ELF_DATA,
+ PPC64_ELF_DATA,
+ S390_ELF_DATA,
+ SH_ELF_DATA,
+ SPARC_ELF_DATA,
+ SPU_ELF_DATA,
+ X86_64_ELF_DATA,
+ XTENSA_ELF_DATA,
+ GENERIC_ELF_DATA
+};
+
/* ELF linker hash table. */
struct elf_link_hash_table
{
struct bfd_link_hash_table root;
+ /* An identifier used to distinguish different target
+ specific extensions to this structure. */
+ enum elf_target_id hash_table_id;
+
/* Whether we have created the special dynamic sections required
when linking against or generating a shared object. */
bfd_boolean dynamic_sections_created;
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
+#define elf_hash_table_id(table) ((table) -> hash_table_id)
+
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
#define is_elf_hash_table(htab) \
(((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
Tag_compatibility = 32
};
-/* Enum used to identify target specific extensions to the elf_obj_tdata
- structure. Note the enums deliberately start from 1 so that we can
- detect an uninitialized field. The generic value is last so that
- additions to this enum do not need to modify more than one line. */
-enum elf_object_id
-{
- ALPHA_ELF_TDATA = 1,
- ARM_ELF_TDATA,
- HPPA_ELF_TDATA,
- I386_ELF_TDATA,
- MIPS_ELF_TDATA,
- PPC32_ELF_TDATA,
- PPC64_ELF_TDATA,
- S390_ELF_TDATA,
- SH_ELF_TDATA,
- SPARC_ELF_TDATA,
- X86_64_ELF_TDATA,
- XTENSA_ELF_TDATA,
- GENERIC_ELF_TDATA
-};
-
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
/* An identifier used to distinguish different target
specific extensions to this structure. */
- enum elf_object_id object_id;
+ enum elf_target_id object_id;
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
extern bfd_reloc_status_type bfd_elf_generic_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern bfd_boolean bfd_elf_allocate_object
- (bfd *, size_t, enum elf_object_id);
+ (bfd *, size_t, enum elf_target_id);
extern bfd_boolean bfd_elf_make_generic_object
(bfd *);
extern bfd_boolean bfd_elf_mkcorefile
(struct elf_link_hash_table *, bfd *,
struct bfd_hash_entry *(*)
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
- unsigned int);
+ unsigned int, enum elf_target_id);
extern bfd_boolean _bfd_elf_slurp_version_tables
(bfd *, bfd_boolean);
extern bfd_boolean _bfd_elf_merge_sections
/* Matsushita 10300 specific support for 32-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Get the MN10300 ELF linker hash table from a link_info structure. */
#define elf32_mn10300_hash_table(p) \
- ((struct elf32_mn10300_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == MN10300_ELF_DATA ? ((struct elf32_mn10300_link_hash_table *) ((p)->hash)) : NULL)
#define elf32_mn10300_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
/* We need a pointer to the mn10300 specific hash table. */
hash_table = elf32_mn10300_hash_table (link_info);
+ if (hash_table == NULL)
+ return FALSE;
/* Initialize fields in each hash table entry the first time through. */
if ((hash_table->flags & MN10300_HASH_ENTRIES_INITIALIZED) == 0)
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elf32_mn10300_link_hash_newfunc,
- sizeof (struct elf32_mn10300_link_hash_entry)))
+ sizeof (struct elf32_mn10300_link_hash_entry),
+ MN10300_ELF_DATA))
{
free (ret);
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->static_hash_table->root, abfd,
elf32_mn10300_link_hash_newfunc,
- sizeof (struct elf32_mn10300_link_hash_entry)))
+ sizeof (struct elf32_mn10300_link_hash_entry),
+ MN10300_ELF_DATA))
{
free (ret->static_hash_table);
free (ret);
bfd_boolean
bfd_elf_allocate_object (bfd *abfd,
size_t object_size,
- enum elf_object_id object_id)
+ enum elf_target_id object_id)
{
BFD_ASSERT (object_size >= sizeof (struct elf_obj_tdata));
abfd->tdata.any = bfd_zalloc (abfd, object_size);
bfd_elf_make_generic_object (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
- GENERIC_ELF_TDATA);
+ GENERIC_ELF_DATA);
}
bfd_boolean
#define is_arm_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == ARM_ELF_TDATA)
+ && elf_object_id (bfd) == ARM_ELF_DATA)
static bfd_boolean
elf32_arm_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_arm_obj_tdata),
- ARM_ELF_TDATA);
+ ARM_ELF_DATA);
}
/* The ARM linker needs to keep track of the number of relocs that it
/* Get the ARM elf linker hash table from a link_info structure. */
#define elf32_arm_hash_table(info) \
- ((struct elf32_arm_link_hash_table *) ((info)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
+ == ARM_ELF_DATA ? ((struct elf32_arm_link_hash_table *) ((info)->hash)) : NULL)
#define arm_stub_hash_lookup(table, string, create, copy) \
((struct elf32_arm_stub_hash_entry *) \
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* BPABI objects never have a GOT, or associated sections. */
if (htab->symbian_p)
return TRUE;
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!htab->sgot && !create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_link_hash_table_init (& ret->root, abfd,
elf32_arm_link_hash_newfunc,
- sizeof (struct elf32_arm_link_hash_entry)))
+ sizeof (struct elf32_arm_link_hash_entry),
+ ARM_ELF_DATA))
{
free (ret);
return NULL;
return stub_type;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return stub_type;
thumb_only = using_thumb_only (globals);
{
#define MAXRELOCS 2
struct elf32_arm_stub_hash_entry *stub_entry;
+ struct elf32_arm_link_hash_table *globals;
struct bfd_link_info *info;
- struct elf32_arm_link_hash_table *htab;
asection *stub_sec;
bfd *stub_bfd;
bfd_vma stub_addr;
int size;
const insn_sequence *template_sequence;
int i;
- struct elf32_arm_link_hash_table * globals;
int stub_reloc_idx[MAXRELOCS] = {-1, -1};
int stub_reloc_offset[MAXRELOCS] = {0, 0};
int nrelocs = 0;
info = (struct bfd_link_info *) in_arg;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return FALSE;
- htab = elf32_arm_hash_table (info);
stub_sec = stub_entry->stub_sec;
- if ((htab->fix_cortex_a8 < 0)
+ if ((globals->fix_cortex_a8 < 0)
!= (stub_entry->stub_type >= arm_stub_a8_veneer_lwm))
/* We have to do the a8 fixes last, as they are less aligned than
the other veneers. */
bfd_size_type amt;
struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return 0;
if (! is_elf_hash_table (htab))
return 0;
{
struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return;
+
if (isec->output_section->index <= htab->top_index)
{
asection **list = htab->input_list + isec->output_section->index;
unsigned int num_a8_fixes = *num_a8_fixes_p;
unsigned int a8_fix_table_size = *a8_fix_table_size_p;
+ if (htab == NULL)
+ return FALSE;
+
for (section = input_bfd->sections;
section != NULL;
section = section->next)
struct a8_erratum_reloc *a8_relocs = NULL;
unsigned int num_a8_relocs = 0, a8_reloc_table_size = 10, i;
+ if (htab == NULL)
+ return FALSE;
+
if (htab->fix_cortex_a8)
{
a8_fixes = (struct a8_erratum_fix *)
use the PLT stub as target address to
decide whether a branch stub is
needed. */
- if (globals->splt != NULL && hash != NULL
+ if (globals != NULL
+ && globals->splt != NULL
+ && hash != NULL
&& hash->root.plt.offset != (bfd_vma) -1)
{
sym_sec = globals->splt;
struct elf32_arm_link_hash_table *globals =
elf32_arm_hash_table (info);
- if (globals->splt != NULL && hash != NULL
+ if (globals != NULL
+ && globals->splt != NULL
+ && hash != NULL
&& hash->root.plt.offset != (bfd_vma) -1)
{
sym_sec = globals->splt;
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
/* We need a pointer to the armelf specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
+ if (hash_table == NULL)
+ return NULL;
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
/* We need a pointer to the elfarm specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
+ if (hash_table == NULL)
+ return NULL;
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
bfd_size_type size;
globals = elf32_arm_hash_table (link_info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
return;
globals = elf32_arm_hash_table (link_info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
elf32_vfp11_erratum_list *newerr;
hash_table = elf32_arm_hash_table (link_info);
-
BFD_ASSERT (hash_table != NULL);
BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL);
BFD_ASSERT (!(abfd->flags & DYNAMIC));
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
if (globals->bfd_of_glue_owner != NULL)
/* Here we have a bfd that is to be included on the link. We have a
hook to do reloc rummaging, before section sizes are nailed down. */
globals = elf32_arm_hash_table (link_info);
-
BFD_ASSERT (globals != NULL);
check_use_blx (globals);
struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
obj_attribute *out_attr = elf_known_obj_attributes_proc (obfd);
+ if (globals == NULL)
+ return;
+
if (globals->fix_cortex_a8 == -1)
{
/* Turn on Cortex-A8 erratum workaround for ARMv7-A. */
struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
obj_attribute *out_attr = elf_known_obj_attributes_proc (obfd);
+ if (globals == NULL)
+ return;
/* We assume that ARMv7+ does not need the VFP11 denorm erratum fix. */
if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7)
{
struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
int use_vector = (globals->vfp11_fix == BFD_ARM_VFP11_FIX_VECTOR);
+ if (globals == NULL)
+ return FALSE;
+
/* We use a simple FSM to match troublesome VFP11 instruction sequences.
The states transition as follows:
return;
globals = elf32_arm_hash_table (link_info);
+ if (globals == NULL)
+ return;
tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
(VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
struct elf32_arm_link_hash_table *globals;
globals = elf32_arm_hash_table (link_info);
+ if (globals == NULL)
+ return;
globals->target1_is_rel = target1_is_rel;
if (strcmp (target2_type, "rel") == 0)
return FALSE;
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
return NULL;
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
struct elf32_arm_link_hash_table * globals;
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
return TRUE;
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
struct elf32_arm_link_hash_table *globals;
globals = elf32_arm_hash_table (info);
-
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
return;
globals = elf32_arm_hash_table (link_info);
+ if (globals == NULL)
+ return;
+
/* If blx is available then exported Thumb symbols are OK and there is
nothing to do. */
if (globals->use_blx)
struct elf32_arm_link_hash_table * globals;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return bfd_reloc_notsupported;
BFD_ASSERT (is_arm_elf (input_bfd));
run time. */
if ((info->shared || globals->root.is_relocatable_executable)
&& (input_section->flags & SEC_ALLOC)
- && !(elf32_arm_hash_table (info)->vxworks_p
+ && !(globals->vxworks_p
&& strcmp (input_section->output_section->name,
".tls_vars") == 0)
&& ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)
struct elf32_arm_link_hash_table * globals;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return FALSE;
symtab_hdr = & elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
{
struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return FALSE;
+
/* Invoke the regular ELF backend linker to do all the work. */
if (!bfd_elf_final_link (abfd, info))
return FALSE;
return TRUE;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return FALSE;
elf_section_data (sec)->local_dynrel = NULL;
break;
case R_ARM_TLS_LDM32:
- elf32_arm_hash_table (info)->tls_ldm_got.refcount -= 1;
+ globals->tls_ldm_got.refcount -= 1;
break;
case R_ARM_ABS32:
BFD_ASSERT (is_arm_elf (abfd));
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
sreloc = NULL;
/* Create dynamic sections for relocatable executables so that we can
struct elf32_arm_link_hash_table *globals;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
/* Make sure we know what is going on here. */
info = (struct bfd_link_info *) inf;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (htab->root.dynamic_sections_created
&& h->plt.refcount > 0)
}
}
- if (elf32_arm_hash_table (info)->vxworks_p)
+ if (htab->vxworks_p)
{
struct elf32_arm_relocs_copied **pp;
struct elf32_arm_link_hash_table *globals;
globals = elf32_arm_hash_table (info);
+ if (globals == NULL)
+ return;
+
globals->byteswap_code = byteswap_code;
}
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
check_use_blx (htab);
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
- bfd_boolean is_vxworks = elf32_arm_hash_table (info)->vxworks_p;
+ bfd_boolean is_vxworks = htab->vxworks_p;
if (! is_arm_elf (ibfd))
continue;
dynobj = elf_hash_table (info)->dynobj;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
eh = (struct elf32_arm_link_hash_entry *) h;
if (h->plt.offset != (bfd_vma) -1)
bfd * dynobj;
asection * sgot;
asection * sdyn;
+ struct elf32_arm_link_hash_table *htab;
+
+ htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
dynobj = elf_hash_table (info)->dynobj;
sgot = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (elf32_arm_hash_table (info)->symbian_p || sgot != NULL);
+ BFD_ASSERT (htab->symbian_p || sgot != NULL);
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
if (elf_hash_table (info)->dynamic_sections_created)
{
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- struct elf32_arm_link_hash_table *htab;
- htab = elf32_arm_hash_table (info);
splt = bfd_get_section_by_name (dynobj, ".plt");
BFD_ASSERT (splt != NULL && sdyn != NULL);
}
/* Fill in the first entry in the procedure linkage table. */
- if (splt->size > 0 && elf32_arm_hash_table (info)->plt_header_size)
+ if (splt->size > 0 && htab->plt_header_size)
{
const bfd_vma *plt0_entry;
bfd_vma got_address, plt_address, got_displacement;
if (link_info)
{
globals = elf32_arm_hash_table (link_info);
- if (globals->byteswap_code)
+ if (globals != NULL && globals->byteswap_code)
i_ehdrp->e_flags |= EF_ARM_BE8;
}
}
bfd_vma offset)
{
static const char *names[3] = {"$a", "$t", "$d"};
- struct elf32_arm_link_hash_table *htab;
Elf_Internal_Sym sym;
- htab = elf32_arm_hash_table (osi->info);
sym.st_value = osi->sec->output_section->vma
+ osi->sec->output_offset
+ offset;
struct elf32_arm_link_hash_entry *eh;
bfd_vma addr;
- htab = elf32_arm_hash_table (osi->info);
-
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
if (h->plt.offset == (bfd_vma) -1)
return TRUE;
+ htab = elf32_arm_hash_table (osi->info);
+ if (htab == NULL)
+ return FALSE;
+
eh = (struct elf32_arm_link_hash_entry *) h;
addr = h->plt.offset;
if (htab->symbian_p)
elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
bfd_vma offset, bfd_vma size)
{
- struct elf32_arm_link_hash_table *htab;
Elf_Internal_Sym sym;
- htab = elf32_arm_hash_table (osi->info);
sym.st_value = osi->sec->output_section->vma
+ osi->sec->output_offset
+ offset;
{
struct elf32_arm_stub_hash_entry *stub_entry;
struct bfd_link_info *info;
- struct elf32_arm_link_hash_table *htab;
asection *stub_sec;
bfd_vma addr;
char *stub_name;
info = osi->info;
- htab = elf32_arm_hash_table (info);
stub_sec = stub_entry->stub_sec;
/* Ensure this stub is attached to the current section being
bfd_size_type size;
htab = elf32_arm_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
check_use_blx (htab);
osi.finfo = finfo;
bfd_byte tmp;
unsigned int i;
+ if (globals == NULL)
+ return FALSE;
+
/* If this section has not been allocated an _arm_elf_section_data
structure then we cannot record anything. */
arm_data = get_arm_elf_section_data (sec);
/* AVR-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
/* We use two hash tables to hold information for linking avr objects.
- The first is the elf32_avr_link_hash_tablse which is derived from the
+ The first is the elf32_avr_link_hash_table which is derived from the
stanard ELF linker hash table. We use this as a place to attach the other
hash table and some static information.
/* Various hash macros and functions. */
#define avr_link_hash_table(p) \
/* PR 3874: Check that we have an AVR style hash table before using it. */\
- ((p)->hash->table.newfunc != elf32_avr_link_hash_newfunc ? NULL : \
- ((struct elf32_avr_link_hash_table *) ((p)->hash)))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == AVR_ELF_DATA ? ((struct elf32_avr_link_hash_table *) ((p)->hash)) : NULL)
#define avr_stub_hash_entry(ent) \
((struct elf32_avr_stub_hash_entry *)(ent))
if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
elf32_avr_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ AVR_ELF_DATA))
{
free (htab);
return NULL;
Elf_Internal_Rela * relend;
struct elf32_avr_link_hash_table * htab = avr_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
asection *section;
asection **input_list, **list;
bfd_size_type amt;
- struct elf32_avr_link_hash_table *htab = avr_link_hash_table(info);
+ struct elf32_avr_link_hash_table *htab = avr_link_hash_table (info);
if (htab == NULL || htab->no_stubs)
return 0;
/* ADI Blackfin BFD support for 32-bit 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.
extern const bfd_target bfd_elf32_bfinfdpic_vec;
#define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_bfinfdpic_vec)
-/* An extension of the elf hash table data structure, containing some
- additional Blackfin-specific data. */
+/* An extension of the elf hash table data structure,
+ containing some additional Blackfin-specific data. */
struct bfinfdpic_elf_link_hash_table
{
struct elf_link_hash_table elf;
/* Get the Blackfin ELF linker hash table from a link_info structure. */
#define bfinfdpic_hash_table(info) \
- ((struct bfinfdpic_elf_link_hash_table *) ((info)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
+ == BFIN_ELF_DATA ? ((struct bfinfdpic_elf_link_hash_table *) ((info)->hash)) : NULL)
#define bfinfdpic_got_section(info) \
(bfinfdpic_hash_table (info)->sgot)
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
_bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ BFIN_ELF_DATA))
{
free (ret);
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
bfin_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ BFIN_ELF_DATA))
{
free (ret);
return NULL;
linking with -Bsymbolic. We store the information in a field
extending the regular ELF linker hash table. */
-struct elf32_cr16_link_hash_entry {
+struct elf32_cr16_link_hash_entry
+{
/* The basic elf link hash table entry. */
struct elf_link_hash_entry root;
bfd_vma value;
};
-/* We derive a hash table from the main elf linker hash table so
- we can store state variables and a secondary hash table without
- resorting to global variables. */
-struct elf32_cr16_link_hash_table {
- /* The main hash table. */
- struct elf_link_hash_table root;
-
- /* A hash table for static functions. We could derive a new hash table
- instead of using the full elf32_cr16_link_hash_table if we wanted
- to save some memory. */
- struct elf32_cr16_link_hash_table *static_hash_table;
-
- /* Random linker state flags. */
-#define CR16_HASH_ENTRIES_INITIALIZED 0x1
- char flags;
-};
-
-/* For CR16 linker hash table. */
-
-/* Get the CR16 ELF linker hash table from a link_info structure. */
-
-#define elf32_cr16_hash_table(p) \
- ((struct elf32_cr16_link_hash_table *) ((p)->hash))
-
-#define elf32_cr16_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
- (bfd_boolean (*) ((struct elf_link_hash_entry *, void *))) (func), (info)))
-
/* cr16_reloc_map array maps BFD relocation enum into a CRGAS relocation type. */
struct cr16_reloc_map
static struct bfd_link_hash_table *
elf32_cr16_link_hash_table_create (bfd *abfd)
{
- struct elf32_cr16_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf32_cr16_link_hash_table);
+ struct elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_link_hash_table);
- ret = (struct elf32_cr16_link_hash_table *) bfd_malloc (amt);
- if (ret == (struct elf32_cr16_link_hash_table *) NULL)
+ ret = (struct elf_link_hash_table *) bfd_malloc (amt);
+ if (ret == (struct elf_link_hash_table *) NULL)
return NULL;
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ if (!_bfd_elf_link_hash_table_init (ret, abfd,
elf32_cr16_link_hash_newfunc,
- sizeof (struct elf32_cr16_link_hash_entry)))
- {
- free (ret);
- return NULL;
- }
-
- ret->flags = 0;
- amt = sizeof (struct elf_link_hash_table);
- ret->static_hash_table
- = (struct elf32_cr16_link_hash_table *) bfd_malloc (amt);
- if (ret->static_hash_table == NULL)
+ sizeof (struct elf32_cr16_link_hash_entry),
+ GENERIC_ELF_DATA))
{
free (ret);
return NULL;
}
- if (!_bfd_elf_link_hash_table_init (&ret->static_hash_table->root, abfd,
- elf32_cr16_link_hash_newfunc,
- sizeof (struct elf32_cr16_link_hash_entry)))
- {
- free (ret->static_hash_table);
- free (ret);
- return NULL;
- }
- return &ret->root.root;
+ return &ret->root;
}
/* Free an cr16 ELF linker hash table. */
static void
elf32_cr16_link_hash_table_free (struct bfd_link_hash_table *hash)
{
- struct elf32_cr16_link_hash_table *ret
- = (struct elf32_cr16_link_hash_table *) hash;
+ struct elf_link_hash_table *ret
+ = (struct elf_link_hash_table *) hash;
- _bfd_generic_link_hash_table_free
- ((struct bfd_link_hash_table *) ret->static_hash_table);
_bfd_generic_link_hash_table_free
((struct bfd_link_hash_table *) ret);
}
/* CRIS-specific support for 32-bit ELF.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson, based on elf32-fr30.c
PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
#define elf_cris_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info)))
/* Get the CRIS ELF linker hash table from a link_info structure. */
#define elf_cris_hash_table(p) \
- ((struct elf_cris_link_hash_table *) (p)->hash)
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == CRIS_ELF_DATA ? ((struct elf_cris_link_hash_table *) ((p)->hash)) : NULL)
/* Get the CRIS ELF linker hash entry from a regular hash entry (the
"parent class"). The .root reference is just a simple type
/* Create an entry in a CRIS ELF linker hash table. */
static struct bfd_hash_entry *
-elf_cris_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+elf_cris_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct elf_cris_link_hash_entry *ret =
(struct elf_cris_link_hash_entry *) entry;
/* Create a CRIS ELF linker hash table. */
static struct bfd_link_hash_table *
-elf_cris_link_hash_table_create (abfd)
- bfd *abfd;
+elf_cris_link_hash_table_create (bfd *abfd)
{
struct elf_cris_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_cris_link_hash_table);
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elf_cris_link_hash_newfunc,
- sizeof (struct elf_cris_link_hash_entry)))
+ sizeof (struct elf_cris_link_hash_entry),
+ CRIS_ELF_DATA))
{
free (ret);
return NULL;
copied, for further comments. */
static bfd_boolean
-cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
+cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
+ struct elf_cris_link_hash_table * htab;
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *relend;
asection *srelgot;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
indx = elf_section_data (osec)->dynindx;
if (indx == 0)
{
- struct elf_cris_link_hash_table *htab;
- htab = elf_cris_hash_table (info);
osec = htab->root.text_index_section;
indx = elf_section_data (osec)->dynindx;
}
}
BFD_ASSERT ((input_section->flags & SEC_ALLOC) == 0
- || elf_cris_hash_table (info)->dtpmod_refcount != 0);
+ || htab->dtpmod_refcount != 0);
/* Fill in a R_CRIS_DTPMOD reloc at offset 3 if we haven't
already done so. Note that we do this in .got.plt, not
in .got, as .got.plt contains the first part, still the
reloc is against .got, because the linker script directs
(is required to direct) them both into .got. */
- if (elf_cris_hash_table (info)->dtpmod_refcount > 0
+ if (htab->dtpmod_refcount > 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
asection *sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
/* Reverse the sign to mark that we've emitted the
required GOT entry. */
- elf_cris_hash_table (info)->dtpmod_refcount
- = -elf_cris_hash_table (info)->dtpmod_refcount;
+ htab->dtpmod_refcount = - htab->dtpmod_refcount;
}
/* The relocation is the offset from the start of the module
dynamic sections here. */
static bfd_boolean
-elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf_cris_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
+ struct elf_cris_link_hash_table * htab;
bfd *dynobj;
/* Where in the plt entry to put values. */
const bfd_byte *plt_entry = elf_cris_plt_entry;
const bfd_byte *plt_pic_entry = elf_cris_pic_plt_entry;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* Adjust the various PLT entry offsets. */
if (bfd_get_mach (output_bfd) == bfd_mach_cris_v32)
{
processed as part of the runtime lazy .rela.plt relocation).
FIXME: There be literal constants here... */
bfd_vma rela_plt_index
- = (elf_cris_hash_table (info)->dtpmod_refcount != 0
+ = (htab->dtpmod_refcount != 0
? gotplt_offset/4 - 2 - 3 : gotplt_offset/4 - 3);
/* Get the offset into the .got table of the entry that corresponds
bfd_vma got_offset
= (has_gotplt
? gotplt_offset
- : h->got.offset + elf_cris_hash_table(info)->next_gotplt_entry);
+ : h->got.offset + htab->next_gotplt_entry);
/* This symbol has an entry in the procedure linkage table. Set it
up. */
asection *sec,
const Elf_Internal_Rela *relocs)
{
+ struct elf_cris_link_hash_table * htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
if (dynobj == NULL)
return TRUE;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
break;
/* Fall through. */
case R_CRIS_16_DTPREL:
- elf_cris_hash_table (info)->dtpmod_refcount--;
- if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
- elf_cris_hash_table (info)->next_gotplt_entry -= 8;
+ htab->dtpmod_refcount--;
+ if (htab->dtpmod_refcount == 0)
+ htab->next_gotplt_entry -= 8;
BFD_ASSERT (local_got_refcounts != NULL);
local_got_refcounts[-1]--;
break;
understand. */
static bfd_boolean
-elf_cris_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
+ struct elf_cris_link_hash_table * htab;
bfd *dynobj;
asection *s;
bfd_size_type plt_entry_size;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
/* Make sure we know what is going on here. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
((struct elf_cris_link_hash_entry *) h)->gotplt_offset
- = elf_cris_hash_table (info)->next_gotplt_entry;
- elf_cris_hash_table (info)->next_gotplt_entry += 4;
+ = htab->next_gotplt_entry;
+ htab->next_gotplt_entry += 4;
s = bfd_get_section_by_name (dynobj, ".got.plt");
BFD_ASSERT (s != NULL);
/* Look through the relocs for a section during the first phase. */
static bfd_boolean
-cris_elf_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+cris_elf_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
+ struct elf_cris_link_hash_table * htab;
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
if (info->relocatable)
return TRUE;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
case R_CRIS_16_DTPREL:
/* The first .got.plt entry is right after the R_CRIS_DTPMOD
entry at index 3. */
- if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
- elf_cris_hash_table (info)->next_gotplt_entry += 8;
- elf_cris_hash_table (info)->dtpmod_refcount++;
+ if (htab->dtpmod_refcount == 0)
+ htab->next_gotplt_entry += 8;
+
+ htab->dtpmod_refcount++;
/* Fall through. */
case R_CRIS_32_IE:
/* Set the sizes of the dynamic sections. */
static bfd_boolean
-elf_cris_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
+ struct elf_cris_link_hash_table * htab;
bfd *dynobj;
asection *s;
bfd_boolean plt;
bfd_boolean relocs;
+ htab = elf_cris_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
else
{
/* Adjust all expected GOTPLT uses to use a GOT entry instead. */
- elf_cris_link_hash_traverse (elf_cris_hash_table (info),
- elf_cris_adjust_gotplt_to_got,
- (PTR) info);
+ elf_cris_link_hash_traverse (htab, elf_cris_adjust_gotplt_to_got,
+ info);
/* We may have created entries in the .rela.got section.
However, if we are not creating the dynamic sections, we will
visibility changes. For programs, we discard space for relocs for
symbols not referenced by any dynamic object. */
if (info->shared)
- elf_cris_link_hash_traverse (elf_cris_hash_table (info),
+ elf_cris_link_hash_traverse (htab,
elf_cris_discard_excess_dso_dynamics,
- (PTR) info);
+ info);
else
- elf_cris_link_hash_traverse (elf_cris_hash_table (info),
+ elf_cris_link_hash_traverse (htab,
elf_cris_discard_excess_program_dynamics,
- (PTR) info);
+ info);
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
/* The .got.plt contains the .got header as well as the
actual .got.plt contents. The .got header may contain a
R_CRIS_DTPMOD entry at index 3. */
- s->size += elf_cris_hash_table (info)->dtpmod_refcount != 0
+ s->size += htab->dtpmod_refcount != 0
? 8 : 0;
}
else if (CONST_STRNEQ (name, ".rela"))
{
if (strcmp (name, ".rela.got") == 0
- && elf_cris_hash_table (info)->dtpmod_refcount != 0
+ && htab->dtpmod_refcount != 0
&& info->shared)
s->size += sizeof (Elf32_External_Rela);
/* FRV-specific support for 32-bit ELF.
- Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Get the FRV ELF linker hash table from a link_info structure. */
-#define frvfdpic_hash_table(info) \
- ((struct frvfdpic_elf_link_hash_table *) ((info)->hash))
+#define frvfdpic_hash_table(p) \
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == FRV_ELF_DATA ? ((struct frvfdpic_elf_link_hash_table *) ((p)->hash)) : NULL)
#define frvfdpic_got_section(info) \
(frvfdpic_hash_table (info)->sgot)
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
_bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ FRV_ELF_DATA))
{
free (ret);
return NULL;
/* BFD back-end for HP PA-RISC ELF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Original code by
/* Various hash macros and functions. */
#define hppa_link_hash_table(p) \
- ((struct elf32_hppa_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == HPPA32_ELF_DATA ? ((struct elf32_hppa_link_hash_table *) ((p)->hash)) : NULL)
#define hppa_elf_hash_entry(ent) \
((struct elf32_hppa_link_hash_entry *)(ent))
elf32_hppa_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
- HPPA_ELF_TDATA);
+ HPPA32_ELF_DATA);
}
/* Assorted hash table functions. */
return NULL;
if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd, hppa_link_hash_newfunc,
- sizeof (struct elf32_hppa_link_hash_entry)))
+ sizeof (struct elf32_hppa_link_hash_entry),
+ HPPA32_ELF_DATA))
{
free (htab);
return NULL;
info = (struct bfd_link_info *)in_arg;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
stub_sec = hsh->stub_sec;
/* Make a note of the offset within the stubs for this entry. */
/* Don't try to create the .plt and .got twice. */
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (htab->splt != NULL)
return TRUE;
return TRUE;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
eh_syms = elf_sym_hashes (abfd);
sreloc = NULL;
if (r_type == R_PARISC_TLS_LDM21L
|| r_type == R_PARISC_TLS_LDM14R)
- hppa_link_hash_table (info)->tls_ldm_got.refcount += 1;
+ htab->tls_ldm_got.refcount += 1;
else
{
if (hh != NULL)
bfd_signed_vma *local_got_refcounts;
bfd_signed_vma *local_plt_refcounts;
const Elf_Internal_Rela *rela, *relend;
+ struct elf32_hppa_link_hash_table *htab;
if (info->relocatable)
return TRUE;
+ htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
elf_section_data (sec)->local_dynrel = NULL;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
case R_PARISC_TLS_LDM21L:
case R_PARISC_TLS_LDM14R:
- hppa_link_hash_table (info)->tls_ldm_got.refcount -= 1;
+ htab->tls_ldm_got.refcount -= 1;
break;
case R_PARISC_PCREL12F:
same memory location for the variable. */
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* We must generate a COPY reloc to tell the dynamic linker to
copy the initial value out of the dynamic object and into the
info = (struct bfd_link_info *) inf;
hh = hppa_elf_hash_entry (eh);
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (htab->etab.dynamic_sections_created
&& eh->plt.refcount > 0)
{
info = inf;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
hh = hppa_elf_hash_entry (eh);
if (htab->etab.dynamic_sections_created
bfd_boolean relocs;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->etab.dynobj;
if (dynobj == NULL)
abort ();
bfd_size_type amt;
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return -1;
+
/* Count the number of input BFDs and find the top input section id. */
for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
input_bfd != NULL;
{
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return;
+
if (isec->output_section->index <= htab->top_index)
{
asection **list = htab->input_list + isec->output_section->index;
int stub_changed = 0;
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return -1;
+
/* We want to read in symbol extension records only once. To do this
we need to read in the local symbols in parallel and save them for
later use; so hold pointers to the local symbols in an array. */
bfd_boolean stub_changed;
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* Stash our params away. */
htab->stub_bfd = stub_bfd;
htab->multi_subspace = multi_subspace;
struct elf32_hppa_link_hash_table *htab;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
h = bfd_link_hash_lookup (&htab->etab.root, "$global$", FALSE, FALSE, FALSE);
if (h != NULL
struct elf32_hppa_link_hash_table *htab;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
struct elf32_hppa_link_hash_table *htab;
htab = (struct elf32_hppa_link_hash_table*) data;
+ if (htab == NULL)
+ return;
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
local_got_offsets = elf_local_got_offsets (input_bfd);
rela = relocs;
bfd_byte *loc;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (eh->plt.offset != (bfd_vma) -1)
{
asection *sdyn;
htab = hppa_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->etab.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#define is_i386_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == I386_ELF_TDATA)
+ && elf_object_id (bfd) == I386_ELF_DATA)
static bfd_boolean
elf_i386_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_i386_obj_tdata),
- I386_ELF_TDATA);
+ I386_ELF_DATA);
}
/* i386 ELF linker hash table. */
asection *sdynbss;
asection *srelbss;
- /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
- asection *srelplt2;
-
- /* True if the target system is VxWorks. */
- int is_vxworks;
-
- /* Value used to fill the last word of the first plt entry. */
- bfd_byte plt0_pad_byte;
-
- /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */
- bfd_vma next_tls_desc_index;
-
- union {
+ union
+ {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
/* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table;
- void *loc_hash_memory;
+ void * loc_hash_memory;
+
+ /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
+ asection *srelplt2;
+
+ /* True if the target system is VxWorks. */
+ int is_vxworks;
+
+ /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */
+ bfd_vma next_tls_desc_index;
+
+ /* Value used to fill the last word of the first plt entry. */
+ bfd_byte plt0_pad_byte;
};
/* Get the i386 ELF linker hash table from a link_info structure. */
#define elf_i386_hash_table(p) \
- ((struct elf_i386_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == I386_ELF_DATA ? ((struct elf_i386_link_hash_table *) ((p)->hash)) : NULL)
#define elf_i386_compute_jump_table_size(htab) \
((htab)->next_tls_desc_index * 4)
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
elf_i386_link_hash_newfunc,
- sizeof (struct elf_i386_link_hash_entry)))
+ sizeof (struct elf_i386_link_hash_entry),
+ I386_ELF_DATA))
{
free (ret);
return NULL;
return FALSE;
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
if (!info->shared)
htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
name = h->root.root.string;
else
{
- Elf_Internal_Sym *isym;
struct elf_i386_link_hash_table *htab;
+
htab = elf_i386_hash_table (info);
- isym = bfd_sym_from_r_symndx (&htab->sym_cache,
- abfd, r_symndx);
- name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
+ if (htab == NULL)
+ name = "*unknown*";
+ else
+ {
+ Elf_Internal_Sym *isym;
+
+ isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ abfd, r_symndx);
+ name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
+ }
}
(*_bfd_error_handler)
BFD_ASSERT (is_i386_elf (abfd));
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
asection *sec,
const Elf_Internal_Rela *relocs)
{
+ struct elf_i386_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
if (info->relocatable)
return TRUE;
+ htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
elf_section_data (sec)->local_dynrel = NULL;
symtab_hdr = &elf_symtab_hdr (abfd);
switch (r_type)
{
case R_386_TLS_LDM:
- if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
+ if (htab->tls_ldm_got.refcount > 0)
+ htab->tls_ldm_got.refcount -= 1;
break;
case R_386_TLS_GD:
}
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* If there aren't any dynamic relocs in read-only sections, then
we can keep the dynamic relocs and avoid the copy reloc. This
info = (struct bfd_link_info *) inf;
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
bfd *ibfd;
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
dynobj = htab->elf.dynobj;
if (dynobj == NULL)
abort ();
if (tlsbase && tlsbase->type == STT_TLS)
{
+ struct elf_i386_link_hash_table *htab;
struct bfd_link_hash_entry *bh = NULL;
const struct elf_backend_data *bed
= get_elf_backend_data (output_bfd);
+ htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!(_bfd_generic_link_add_one_symbol
(info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
tls_sec, 0, NULL, FALSE,
bed->collect, &bh)))
return FALSE;
- elf_i386_hash_table (info)->tls_module_base = bh;
+ htab->tls_module_base = bh;
tlsbase = (struct elf_link_hash_entry *)bh;
tlsbase->def_regular = 1;
static void
elf_i386_set_tls_module_base (struct bfd_link_info *info)
{
+ struct elf_i386_link_hash_table *htab;
struct bfd_link_hash_entry *base;
if (!info->executable)
return;
- base = elf_i386_hash_table (info)->tls_module_base;
+ htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return;
- if (!base)
+ base = htab->tls_module_base;
+ if (base == NULL)
return;
- base->u.def.value = elf_hash_table (info)->tls_size;
+ base->u.def.value = htab->elf.tls_size;
}
/* Return the base VMA address which should be subtracted from real addresses
BFD_ASSERT (is_i386_elf (input_bfd));
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
struct elf_i386_link_hash_table *htab;
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (h->plt.offset != (bfd_vma) -1)
{
asection *sdyn;
htab = elf_i386_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
/* Lattice Mico32-specific support for 32-bit ELF
- Copyright 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Jon Beniston <jon@beniston.com>
This file is part of BFD, the Binary File Descriptor library.
/* Get the lm32 ELF linker hash table from a link_info structure. */
#define lm32_elf_hash_table(p) \
- ((struct elf_lm32_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == LM32_ELF_DATA ? ((struct elf_lm32_link_hash_table *) ((p)->hash)) : NULL)
#define lm32fdpic_got_section(info) \
(lm32_elf_hash_table (info)->sgot)
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
lm32_elf_link_hash_newfunc,
- sizeof (struct elf_lm32_link_hash_entry)))
+ sizeof (struct elf_lm32_link_hash_entry),
+ LM32_ELF_DATA))
{
free (ret);
return NULL;
if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
return TRUE;
+ htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (! _bfd_elf_create_got_section (dynobj, info))
return FALSE;
- htab = lm32_elf_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
struct elf_lm32_link_hash_table *htab;
htab = lm32_elf_hash_table (info);
- /* Fixup section for R_LM32_32 relocs */
+ if (htab == NULL)
+ return FALSE;
+
+ /* Fixup section for R_LM32_32 relocs. */
lm32fdpic_fixup32_section (info) = bfd_make_section_with_flags (dynobj,
".rofixup",
(SEC_ALLOC
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
Elf_Internal_Rela *rel, *relend;
-
struct elf_lm32_link_hash_table *htab = lm32_elf_hash_table (info);
bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc;
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
sym_hashes_end -= symtab_hdr->sh_info;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (abfd);
asection *sgot;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
sgot = htab->sgotplt;
bfd_byte *loc;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
if (h->plt.offset != (bfd_vma) -1)
same memory location for the variable. */
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
s = htab->sdynbss;
BFD_ASSERT (s != NULL);
info = (struct bfd_link_info *) inf;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
eh = (struct elf_lm32_link_hash_entry *) h;
bfd *ibfd;
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
int ptralign = 2; /* 32bit */
htab = lm32_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Make sure we have a GOT - For the case where we have a dynamic object
but none of the relocs in check_relocs */
/* M32R-specific support for 32-bit ELF.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Get the m32r ELF linker hash table from a link_info structure. */
-
#define m32r_elf_hash_table(p) \
- ((struct elf_m32r_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == M32R_ELF_DATA ? ((struct elf_m32r_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in an m32r ELF linker hash table. */
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
m32r_elf_link_hash_newfunc,
- sizeof (struct elf_m32r_link_hash_entry)))
+ sizeof (struct elf_m32r_link_hash_entry),
+ M32R_ELF_DATA))
{
free (ret);
return NULL;
return FALSE;
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
int ptralign = 2; /* 32bit */
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
.rel[a].bss sections. */
same memory location for the variable. */
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
s = htab->sdynbss;
BFD_ASSERT (s != NULL);
info = (struct bfd_link_info *) inf;
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
eh = (struct elf_m32r_link_hash_entry *) h;
#endif
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
Elf_Internal_Rela *rel, *relend;
/* Assume success. */
bfd_boolean ret = TRUE;
-
struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info);
bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc;
bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
#endif
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
if (h->plt.offset != (bfd_vma) -1)
#endif
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
sgot = htab->sgotplt;
sym_hashes = elf_sym_hashes (abfd);
htab = m32r_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (abfd);
/* Motorola 68HC11-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
(Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
info = (struct bfd_link_info *) in_arg;
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
stub_sec = stub_entry->stub_sec;
/* Motorola 68HC11/HC12-specific support for 32-bit ELF
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009 Free Software Foundation, Inc.
+ 2009, 2010 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
This file is part of BFD, the Binary File Descriptor library.
memset (ret, 0, amt);
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
_bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ M68HC11_ELF_DATA))
{
free (ret);
return NULL;
struct m68hc11_elf_link_hash_table *htab;
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return -1;
if (bfd_get_flavour (info->output_bfd) != bfd_target_elf_flavour)
return 0;
unsigned int bfd_indx, bfd_count;
bfd_size_type amt;
asection *stub_sec;
-
struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* Stash our params away. */
htab->stub_bfd = stub_bfd;
htab->add_stub_section = add_stub_section;
for (input_bfd = info->input_bfds, bfd_count = 0;
input_bfd != NULL;
input_bfd = input_bfd->link_next)
- {
- bfd_count += 1;
- }
+ bfd_count += 1;
/* We want to read in symbol extension records only once. To do this
we need to read in the local symbols in parallel and save them for
info = (struct bfd_link_info *) in_arg;
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Massage our args to the form they really have. */
stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry;
m68hc11_elf_get_bank_parameters (info);
htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
unsigned i;
struct m68hc11_page_info *pinfo;
struct bfd_link_hash_entry *h;
+ struct m68hc11_elf_link_hash_table *htab;
+
+ htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return;
- pinfo = &m68hc11_elf_hash_table (info)->pinfo;
+ pinfo = & htab->pinfo;
if (pinfo->bank_param_initialized)
return;
const char *name = NULL;
struct m68hc11_page_info *pinfo;
const struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd);
+ struct m68hc11_elf_link_hash_table *htab;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
+ htab = m68hc11_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* Get memory bank parameters. */
m68hc11_elf_get_bank_parameters (info);
- pinfo = &m68hc11_elf_hash_table (info)->pinfo;
+ pinfo = & htab->pinfo;
rel = relocs;
relend = relocs + input_section->reloc_count;
+
for (; rel < relend; rel++)
{
int r_type;
if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16)
{
struct elf32_m68hc11_stub_hash_entry* stub;
- struct m68hc11_elf_link_hash_table *htab;
- htab = m68hc11_elf_hash_table (info);
stub = m68hc12_stub_hash_lookup (htab->stub_hash_table,
name, FALSE, FALSE);
if (stub)
elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info)
{
struct m68hc11_scan_param param;
+ struct m68hc11_elf_link_hash_table *htab;
+
+ if (link_info == NULL)
+ return;
- if (link_info == 0)
+ htab = m68hc11_elf_hash_table (link_info);
+ if (htab == NULL)
return;
m68hc11_elf_get_bank_parameters (link_info);
param.use_memory_banks = FALSE;
- param.pinfo = &m68hc11_elf_hash_table (link_info)->pinfo;
+ param.pinfo = & htab->pinfo;
+
bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m);
+
if (param.use_memory_banks)
{
Elf_Internal_Ehdr * i_ehdrp;
i_ehdrp->e_flags |= E_M68HC12_BANKS;
}
}
-
/* Motorola 68HC11/68HC12-specific support for 32-bit ELF
- Copyright 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010
+ Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
This file is part of BFD, the Binary File Descriptor library.
The trampoline is used when a pointer to a far function is used.
It takes care of installing the proper memory bank as well as creating
the 'call/rtc' calling convention. */
-struct elf32_m68hc11_stub_hash_entry {
-
+struct elf32_m68hc11_stub_hash_entry
+{
/* Base hash table entry structure. */
struct bfd_hash_entry root;
less or equal to the page size)
For 68HC12, the window is at 0x8000 and the page size is 16K (full window).
- For 68HC11 this is board specific (implemented by external hardware).
+ For 68HC11 this is board specific (implemented by external hardware). */
-*/
struct m68hc11_page_info
{
bfd_vma bank_virtual;
asection* tramp_section;
/* Linker call-backs. */
- asection * (*add_stub_section) PARAMS ((const char *, asection *));
+ asection * (*add_stub_section) (const char *, asection *);
/* Assorted information used by elf32_hppa_size_stubs. */
unsigned int bfd_count;
/* Small local sym cache. */
struct sym_cache sym_cache;
- bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, void*));
- bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, void*));
+ bfd_boolean (* size_one_stub) (struct bfd_hash_entry*, void*);
+ bfd_boolean (* build_one_stub) (struct bfd_hash_entry*, void*);
};
/* Get the Sparc64 ELF linker hash table from a link_info structure. */
#define m68hc11_elf_hash_table(p) \
- ((struct m68hc11_elf_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == M68HC11_ELF_DATA ? ((struct m68hc11_elf_link_hash_table *) ((p)->hash)) : NULL)
/* Create a 68HC11/68HC12 ELF linker hash table. */
/* Motorola 68k series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Get the m68k ELF linker hash table from a link_info structure. */
#define elf_m68k_hash_table(p) \
- ((struct elf_m68k_link_hash_table *) (p)->hash)
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == M68K_ELF_DATA ? ((struct elf_m68k_link_hash_table *) ((p)->hash)) : NULL)
/* Shortcut to multi-GOT data. */
#define elf_m68k_multi_got(INFO) (&elf_m68k_hash_table (INFO)->multi_got_)
/* Create an entry in an m68k ELF linker hash table. */
static struct bfd_hash_entry *
-elf_m68k_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+elf_m68k_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct bfd_hash_entry *ret = entry;
/* Create an m68k ELF linker hash table. */
static struct bfd_link_hash_table *
-elf_m68k_link_hash_table_create (abfd)
- bfd *abfd;
+elf_m68k_link_hash_table_create (bfd *abfd)
{
struct elf_m68k_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table);
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elf_m68k_link_hash_newfunc,
- sizeof (struct elf_m68k_link_hash_entry)))
+ sizeof (struct elf_m68k_link_hash_entry),
+ M68K_ELF_DATA))
{
free (ret);
return NULL;
/* Get the ELF linker hash table from a link_info structure. */
#define elf32_mb_hash_table(p) \
- ((struct elf32_mb_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == MICROBLAZE_ELF_DATA ? ((struct elf32_mb_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in a microblaze ELF linker hash table. */
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
- sizeof (struct elf32_mb_link_hash_entry)))
+ sizeof (struct elf32_mb_link_hash_entry),
+ MICROBLAZE_ELF_DATA))
{
free (ret);
return NULL;
microblaze_elf_howto_init ();
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
local_got_offsets = elf_local_got_offsets (input_bfd);
sreloc = elf_section_data (input_section)->sreloc;
if (! _bfd_elf_create_got_section (dynobj, info))
return FALSE;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
if (!htab->sgot || !htab->sgotplt)
return TRUE;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
local_got_offsets = elf_local_got_offsets (abfd);
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
struct elf32_mb_link_hash_table *htab;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!htab->sgot && !create_got_section (dynobj, info))
return FALSE;
bfd *dynobj;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later,
info = (struct bfd_link_info *) dat;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0)
bfd *ibfd;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
BFD_ASSERT (dynobj != NULL);
struct elf32_mb_link_hash_table *htab;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
if (h->plt.offset != (bfd_vma) -1)
struct elf32_mb_link_hash_table *htab;
htab = elf32_mb_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
#define is_ppc_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
- && elf_object_id (bfd) == PPC32_ELF_TDATA)
+ && elf_object_id (bfd) == PPC32_ELF_DATA)
/* Override the generic function because we store some extras. */
ppc_elf_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct ppc_elf_obj_tdata),
- PPC32_ELF_TDATA);
+ PPC32_ELF_DATA);
}
/* Fix bad default arch selected for a 32 bit input bfd when the
/* Get the PPC ELF linker hash table from a link_info structure. */
#define ppc_elf_hash_table(p) \
- ((struct ppc_elf_link_hash_table *) (p)->hash)
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == PPC32_ELF_DATA ? ((struct ppc_elf_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in a PPC ELF linker hash table. */
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
ppc_elf_link_hash_newfunc,
- sizeof (struct ppc_elf_link_hash_entry)))
+ sizeof (struct ppc_elf_link_hash_entry),
+ PPC32_ELF_DATA))
{
free (ret);
return NULL;
#define is_s390_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == S390_ELF_TDATA)
+ && elf_object_id (bfd) == S390_ELF_DATA)
static bfd_boolean
elf_s390_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata),
- S390_ELF_TDATA);
+ S390_ELF_DATA);
}
static bfd_boolean
/* Get the s390 ELF linker hash table from a link_info structure. */
#define elf_s390_hash_table(p) \
- ((struct elf_s390_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == S390_ELF_DATA ? ((struct elf_s390_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in an s390 ELF linker hash table. */
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
- sizeof (struct elf_s390_link_hash_entry)))
+ sizeof (struct elf_s390_link_hash_entry),
+ S390_ELF_DATA))
{
free (ret);
return NULL;
/* 32-bit ELF support for S+core.
- Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by
Brain.lin (brain.lin@sunplusct.com)
Mei Ligang (ligang@sunnorth.com.cn)
int score3 = 0;
int score7 = 1;
-/* Score ELF linker hash table. */
-struct score_elf_link_hash_table
-{
- /* The main hash table. */
- struct elf_link_hash_table root;
-};
-
/* The SCORE ELF linker needs additional information for each symbol in
the global hash table. */
struct score_elf_link_hash_entry
/* Traverse a score ELF linker hash table. */
#define score_elf_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
- (&(table)->root, \
+ ((table), \
(bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info)))
-/* Get the SCORE elf linker hash table from a link_info structure. */
-#define score_elf_hash_table(info) \
- ((struct score_elf_link_hash_table *) ((info)->hash))
-
/* This structure is used to hold .got entries while estimating got sizes. */
struct score_got_entry
{
too large offsets. */
- (g->next ? g->assigned_gotno : 0);
hsd.max_non_got_dynindx = max_local;
- score_elf_link_hash_traverse (((struct score_elf_link_hash_table *)
- elf_hash_table (info)),
- score_elf_sort_hash_table_f,
- &hsd);
+ score_elf_link_hash_traverse (elf_hash_table (info),
+ score_elf_sort_hash_table_f,
+ &hsd);
/* There should have been enough room in the symbol table to
accommodate both the GOT and non-GOT symbols. */
}
/* Create an entry in an score ELF linker hash table. */
+
static struct bfd_hash_entry *
score_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
{
- struct score_elf_link_hash_entry *ret = (struct score_elf_link_hash_entry *)entry;
+ struct score_elf_link_hash_entry *ret = (struct score_elf_link_hash_entry *) entry;
/* Allocate the structure if it has not already been allocated by a subclass. */
if (ret == NULL)
ret = bfd_hash_allocate (table, sizeof (struct score_elf_link_hash_entry));
if (ret == NULL)
- return (struct bfd_hash_entry *)ret;
+ return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
ret = ((struct score_elf_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *)ret, table, string));
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
if (ret != NULL)
{
ret->forced_local = FALSE;
}
- return (struct bfd_hash_entry *)ret;
+ return (struct bfd_hash_entry *) ret;
}
/* Returns the first relocation of type r_type found, beginning with
{
g = score_elf_global_got_index (elf_hash_table (info)->dynobj,
(struct elf_link_hash_entry *) h);
- if ((! elf_hash_table(info)->dynamic_sections_created
+ if ((! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
&& (info->symbolic || h->root.dynindx == -1)
&& h->root.def_regular)))
return NULL;
}
-/* Create a score elf linker hash table. */
-
-static struct bfd_link_hash_table *
-s3_elf32_score_link_hash_table_create (bfd *abfd)
-{
- struct score_elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct score_elf_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, score_elf_link_hash_newfunc,
- sizeof (struct score_elf_link_hash_entry)))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
static bfd_boolean
s3_elf32_score_print_private_bfd_data (bfd *abfd, void * ptr)
{
return s7_elf32_score_reloc_type_lookup (abfd, code);
}
+/* Create a score elf linker hash table.
+ This is a copy of _bfd_elf_link_hash_table_create() except with a
+ different hash table entry creation function. */
+
static struct bfd_link_hash_table *
elf32_score_link_hash_table_create (bfd *abfd)
{
- if (bfd_get_mach (abfd) == bfd_mach_score3)
- return s3_elf32_score_link_hash_table_create (abfd);
- else
- return s7_elf32_score_link_hash_table_create (abfd);
+ struct elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_link_hash_table);
+
+ ret = (struct elf_link_hash_table *) bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (ret, abfd, score_elf_link_hash_newfunc,
+ sizeof (struct score_elf_link_hash_entry),
+ GENERIC_ELF_DATA))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ return &ret->root;
}
static bfd_boolean
/* 32-bit ELF support for S+core.
- Copyright 2009 Free Software Foundation, Inc.
+ Copyright 2009, 2010 Free Software Foundation, Inc.
Contributed by
Brain.lin (brain.lin@sunplusct.com)
Mei Ligang (ligang@sunnorth.com.cn)
#include "elf32-score.h"
-/* Score ELF linker hash table. */
-struct score_elf_link_hash_table
-{
- /* The main hash table. */
- struct elf_link_hash_table root;
-};
-
/* The SCORE ELF linker needs additional information for each symbol in
the global hash table. */
struct score_elf_link_hash_entry
/* Traverse a score ELF linker hash table. */
#define score_elf_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
- (&(table)->root, \
+ ((table), \
(bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info)))
-/* Get the SCORE elf linker hash table from a link_info structure. */
-#define score_elf_hash_table(info) \
- ((struct score_elf_link_hash_table *) ((info)->hash))
-
/* This structure is used to hold .got entries while estimating got sizes. */
struct score_got_entry
{
too large offsets. */
- (g->next ? g->assigned_gotno : 0);
hsd.max_non_got_dynindx = max_local;
- score_elf_link_hash_traverse (((struct score_elf_link_hash_table *)
- elf_hash_table (info)),
- score_elf_sort_hash_table_f,
- &hsd);
+ score_elf_link_hash_traverse (elf_hash_table (info),
+ score_elf_sort_hash_table_f,
+ &hsd);
/* There should have been enough room in the symbol table to
accommodate both the GOT and non-GOT symbols. */
return TRUE;
}
-/* Create an entry in an score ELF linker hash table. */
-
-static struct bfd_hash_entry *
-score_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-{
- struct score_elf_link_hash_entry *ret = (struct score_elf_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a subclass. */
- if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (struct score_elf_link_hash_entry));
- if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct score_elf_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret != NULL)
- {
- ret->possibly_dynamic_relocs = 0;
- ret->readonly_reloc = FALSE;
- ret->no_fn_stub = FALSE;
- ret->forced_local = FALSE;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
/* Returns the first relocation of type r_type found, beginning with
RELOCATION. RELEND is one-past-the-end of the relocation table. */
return NULL;
}
-/* Create a score elf linker hash table. */
-
-struct bfd_link_hash_table *
-s7_elf32_score_link_hash_table_create (bfd *abfd)
-{
- struct score_elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct score_elf_link_hash_table);
-
- ret = bfd_malloc (amt);
- if (ret == NULL)
- return NULL;
-
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, score_elf_link_hash_newfunc,
- sizeof (struct score_elf_link_hash_entry)))
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
bfd_boolean
s7_elf32_score_print_private_bfd_data (bfd *abfd, void * ptr)
{
/* Renesas / SuperH SH specific support for 32-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
#define is_sh_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == SH_ELF_TDATA)
+ && elf_object_id (bfd) == SH_ELF_DATA)
/* Override the generic function because we need to store sh_elf_obj_tdata
as the specific tdata. */
sh_elf_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct sh_elf_obj_tdata),
- SH_ELF_TDATA);
+ SH_ELF_DATA);
}
/* sh ELF linker hash table. */
/* Get the sh ELF linker hash table from a link_info structure. */
#define sh_elf_hash_table(p) \
- ((struct elf_sh_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == SH_ELF_DATA ? ((struct elf_sh_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in an sh ELF linker hash table. */
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
sh_elf_link_hash_newfunc,
- sizeof (struct elf_sh_link_hash_entry)))
+ sizeof (struct elf_sh_link_hash_entry),
+ SH_ELF_DATA))
{
free (ret);
return NULL;
return FALSE;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
}
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (htab->root.dynamic_sections_created)
return TRUE;
asection *s;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Make sure we know what is going on here. */
BFD_ASSERT (htab->root.dynobj != NULL
info = (struct bfd_link_info *) inf;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
eh = (struct elf_sh_link_hash_entry *) h;
if ((h->got.refcount > 0
bfd *ibfd;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
BFD_ASSERT (is_sh_elf (input_bfd));
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
dynobj = htab->root.dynobj;
sym_hashes = elf_sym_hashes (abfd);
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
local_got_offsets = elf_local_got_offsets (abfd);
rel_end = relocs + sec->reloc_count;
struct elf_sh_link_hash_table *htab;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (h->plt.offset != (bfd_vma) -1)
{
asection *sdyn;
htab = sh_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
sgot = htab->sgotplt;
sdyn = bfd_get_section_by_name (htab->root.dynobj, ".dynamic");
};
#define spu_hash_table(p) \
- ((struct spu_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == SPU_ELF_DATA ? ((struct spu_link_hash_table *) ((p)->hash)) : NULL)
struct call_info
{
if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd,
_bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ SPU_ELF_DATA))
{
free (htab);
return NULL;
/* VAX series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Matt Thomas <matt@3am-software.com>.
This file is part of BFD, the Binary File Descriptor library.
bfd_vma got_addend;
};
-/* VAX ELF linker hash table. */
-
-struct elf_vax_link_hash_table
-{
- struct elf_link_hash_table root;
-};
-
/* Declare this now that the above structures are defined. */
static bfd_boolean elf_vax_discard_copies (struct elf_vax_link_hash_entry *,
- PTR);
+ void *);
/* Declare this now that the above structures are defined. */
static bfd_boolean elf_vax_instantiate_got_entries (struct elf_link_hash_entry *,
- PTR);
+ void *);
/* Traverse an VAX ELF linker hash table. */
#define elf_vax_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
- (&(table)->root, \
+ ((table), \
(bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \
(info)))
-/* Get the VAX ELF linker hash table from a link_info structure. */
-
-#define elf_vax_hash_table(p) ((struct elf_vax_link_hash_table *) (p)->hash)
-
/* Create an entry in an VAX ELF linker hash table. */
static struct bfd_hash_entry *
static struct bfd_link_hash_table *
elf_vax_link_hash_table_create (bfd *abfd)
{
- struct elf_vax_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct elf_vax_link_hash_table);
+ struct elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_link_hash_table);
ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ if (!_bfd_elf_link_hash_table_init (ret, abfd,
elf_vax_link_hash_newfunc,
- sizeof (struct elf_vax_link_hash_entry)))
+ sizeof (struct elf_vax_link_hash_entry),
+ GENERIC_ELF_DATA))
{
free (ret);
return NULL;
}
- return &ret->root.root;
+ return &ret->root;
}
/* Keep vax-specific flags in the ELF header */
allocated space for them in the check_relocs routine, but we will not
fill them in in the relocate_section routine. */
if (info->shared && info->symbolic)
- elf_vax_link_hash_traverse (elf_vax_hash_table (info),
+ elf_vax_link_hash_traverse (elf_hash_table (info),
elf_vax_discard_copies,
NULL);
/* Xtensa-specific support for 32-bit ELF.
- Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#define is_xtensa_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == XTENSA_ELF_TDATA)
+ && elf_object_id (bfd) == XTENSA_ELF_DATA)
static bfd_boolean
elf_xtensa_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_xtensa_obj_tdata),
- XTENSA_ELF_TDATA);
+ XTENSA_ELF_DATA);
}
/* Xtensa ELF linker hash table. */
/* Get the Xtensa ELF linker hash table from a link_info structure. */
#define elf_xtensa_hash_table(p) \
- ((struct elf_xtensa_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == XTENSA_ELF_DATA ? ((struct elf_xtensa_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in an Xtensa ELF linker hash table. */
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
elf_xtensa_link_hash_newfunc,
- sizeof (struct elf_xtensa_link_hash_entry)))
+ sizeof (struct elf_xtensa_link_hash_entry),
+ XTENSA_ELF_DATA))
{
free (ret);
return NULL;
BFD_ASSERT (is_xtensa_elf (abfd));
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
struct elf_xtensa_link_hash_table *htab;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (info->relocatable)
return TRUE;
flagword flags, noalloc_flags;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* First do all the standard stuff. */
if (! _bfd_elf_create_dynamic_sections (dynobj, info))
info = (struct bfd_link_info *) arg;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* If we saw any use of an IE model for this symbol, we can then optimize
away GOT entries for any TLSDESC_FN relocs. */
bfd *i;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return;
for (i = info->input_bfds; i; i = i->link_next)
{
plt_chunks = 0;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
abort ();
asection *tls_sec;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
tls_sec = htab->elf.tls_sec;
if (tls_sec && (htab->tlsbase->tls_type & GOT_TLS_ANY) != 0)
BFD_ASSERT (is_xtensa_elf (input_bfd));
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
local_got_tls_types = elf_xtensa_local_got_tls_type (input_bfd);
return TRUE;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
BFD_ASSERT (sdyn != NULL);
bfd_boolean dynamic_symbol;
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return;
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
if (chunk == 0)
{
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return NULL;
+
return htab->splt;
}
if (chunk == 0)
{
htab = elf_xtensa_hash_table (info);
+ if (htab == NULL)
+ return NULL;
return htab->sgotplt;
}
/* Alpha specific support for 64-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
/* Get the Alpha ELF linker hash table from a link_info structure. */
#define alpha_elf_hash_table(p) \
- ((struct alpha_elf_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == ALPHA_ELF_DATA ? ((struct alpha_elf_link_hash_table *) ((p)->hash)) : NULL)
/* Get the object's symbols as our own entry type. */
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elf64_alpha_link_hash_newfunc,
- sizeof (struct alpha_elf_link_hash_entry)))
+ sizeof (struct alpha_elf_link_hash_entry),
+ ALPHA_ELF_DATA))
{
free (ret);
return NULL;
#define is_alpha_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == ALPHA_ELF_TDATA)
+ && elf_object_id (bfd) == ALPHA_ELF_DATA)
static bfd_boolean
elf64_alpha_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct alpha_elf_obj_tdata),
- ALPHA_ELF_TDATA);
+ ALPHA_ELF_DATA);
}
static bfd_boolean
static void
elf64_alpha_calc_got_offsets (struct bfd_link_info *info)
{
- bfd *i, *got_list = alpha_elf_hash_table(info)->got_list;
+ bfd *i, *got_list;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return;
+ got_list = htab->got_list;
/* First, zero out the .got sizes, as we may be recalculating the
.got after optimizing it. */
alpha_elf_tdata(i)->got->size = 0;
/* Next, fill in the offsets for all the global entries. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ alpha_elf_link_hash_traverse (htab,
elf64_alpha_calc_got_offsets_for_symbol,
NULL);
elf64_alpha_size_got_sections (struct bfd_link_info *info)
{
bfd *i, *got_list, *cur_got_obj = NULL;
+ struct alpha_elf_link_hash_table * htab;
- got_list = alpha_elf_hash_table (info)->got_list;
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+ got_list = htab->got_list;
/* On the first time through, pretend we have an existing got list
consisting of all of the input files. */
if (got_list == NULL)
return TRUE;
- alpha_elf_hash_table (info)->got_list = got_list;
+ htab->got_list = got_list;
}
cur_got_obj = got_list;
asection *splt, *spltrel, *sgotplt;
unsigned long entries;
bfd *dynobj;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return;
dynobj = elf_hash_table(info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
splt->size = 0;
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ alpha_elf_link_hash_traverse (htab,
elf64_alpha_size_plt_section_1, splt);
/* Every plt entry requires a JMP_SLOT relocation. */
struct bfd_link_info *info)
{
bfd *i;
+ struct alpha_elf_link_hash_table * htab;
if (info->relocatable)
return TRUE;
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
/* First, take care of the indirect symbols created by versioning. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_merge_ind_symbols,
+ alpha_elf_link_hash_traverse (htab, elf64_alpha_merge_ind_symbols,
NULL);
if (!elf64_alpha_size_got_sections (info))
return FALSE;
/* Allocate space for all of the .got subsections. */
- i = alpha_elf_hash_table (info)->got_list;
+ i = htab->got_list;
for ( ; i ; i = alpha_elf_tdata(i)->got_link_next)
{
asection *s = alpha_elf_tdata(i)->got;
unsigned long entries;
bfd *i, *dynobj;
asection *srel;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return;
/* Shared libraries often require RELATIVE relocs, and some relocs
require attention for the main application as well. */
entries = 0;
- for (i = alpha_elf_hash_table(info)->got_list;
+ for (i = htab->got_list;
i ; i = alpha_elf_tdata(i)->got_link_next)
{
bfd *j;
srel->size = sizeof (Elf64_External_Rela) * entries;
/* Now do the non-local symbols. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ alpha_elf_link_hash_traverse (htab,
elf64_alpha_size_rela_got_1, info);
}
bfd *dynobj;
asection *s;
bfd_boolean relplt;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
dynobj = elf_hash_table(info)->dynobj;
BFD_ASSERT(dynobj != NULL);
symbols need dynamic relocation entries and which don't. We've
collected information in check_relocs that we can now apply to
size the dynamic relocation sections. */
- alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ alpha_elf_link_hash_traverse (htab,
elf64_alpha_calc_dynrel_sizes, info);
elf64_alpha_size_rela_got_section (info);
Elf_Internal_Sym *isymbuf = NULL;
struct alpha_elf_got_entry **local_got_entries;
struct alpha_relax_info info;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (link_info);
+ if (htab == NULL)
+ return FALSE;
/* There's nothing to change, yet. */
*again = FALSE;
BFD_ASSERT (is_alpha_elf (abfd));
/* Make sure our GOT and PLT tables are up-to-date. */
- if (alpha_elf_hash_table(link_info)->relax_trip != link_info->relax_trip)
+ if (htab->relax_trip != link_info->relax_trip)
{
- alpha_elf_hash_table(link_info)->relax_trip = link_info->relax_trip;
+ htab->relax_trip = link_info->relax_trip;
/* This should never fail after the initial round, since the only
error is GOT overflow, and relaxation only shrinks the table. */
const struct ecoff_debug_swap *swap
= get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
HDRR *symhdr = &debug.symbolic_header;
- PTR mdebug_handle = NULL;
+ void * mdebug_handle = NULL;
+ struct alpha_elf_link_hash_table * htab;
+
+ htab = alpha_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Go through the sections and collect the mdebug information. */
mdebug_sec = NULL;
continue;
name = input_debug.ssext + ext.asym.iss;
- h = alpha_elf_link_hash_lookup (alpha_elf_hash_table (info),
- name, FALSE, FALSE, TRUE);
+ h = alpha_elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
if (h == NULL || h->esym.ifd != -2)
continue;
/* The .got subsections... */
{
bfd *i, *dynobj = elf_hash_table(info)->dynobj;
- for (i = alpha_elf_hash_table(info)->got_list;
+ for (i = htab->got_list;
i != NULL;
i = alpha_elf_tdata(i)->got_link_next)
{
/* Support for HPPA 64-bit ELF
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
};
#define hppa_link_hash_table(p) \
- ((struct elf64_hppa_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == HPPA64_ELF_DATA ? ((struct elf64_hppa_link_hash_table *) ((p)->hash)) : NULL)
#define hppa_elf_hash_entry(ent) \
((struct elf64_hppa_link_hash_entry *)(ent))
if (!_bfd_elf_link_hash_table_init (&htab->root, abfd,
hppa64_link_hash_newfunc,
- sizeof (struct elf64_hppa_link_hash_entry)))
+ sizeof (struct elf64_hppa_link_hash_entry),
+ HPPA64_ELF_DATA))
{
bfd_release (abfd, htab);
return NULL;
}
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* If necessary, build a new table holding section symbols indices
struct elf64_hppa_link_hash_table *hppa_info;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
if (eh->root.type == bfd_link_hash_warning)
eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
allocate_global_data_plt (struct elf_link_hash_entry *eh, void *data)
{
struct elf64_hppa_link_hash_entry *hh = hppa_elf_hash_entry (eh);
- struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data;
+ struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *) data;
if (hh->want_plt
&& elf64_hppa_dynamic_symbol_p (eh, x->info)
hh->plt_offset = x->ofs;
x->ofs += PLT_ENTRY_SIZE;
if (hh->plt_offset < 0x2000)
- hppa_link_hash_table (x->info)->gp_offset = hh->plt_offset;
+ {
+ struct elf64_hppa_link_hash_table *hppa_info;
+
+ hppa_info = hppa_link_hash_table (x->info);
+ if (hppa_info == NULL)
+ return FALSE;
+
+ hppa_info->gp_offset = hh->plt_offset;
+ }
}
else
hh->want_plt = 0;
struct bfd_link_info *info)
{
asection *s;
+ struct elf64_hppa_link_hash_table *hppa_info;
+
+ hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
- if (! get_stub (abfd, info, hppa_link_hash_table (info)))
+ if (! get_stub (abfd, info, hppa_info))
return FALSE;
- if (! get_dlt (abfd, info, hppa_link_hash_table (info)))
+ if (! get_dlt (abfd, info, hppa_info))
return FALSE;
- if (! get_plt (abfd, info, hppa_link_hash_table (info)))
+ if (! get_plt (abfd, info, hppa_info))
return FALSE;
- if (! get_opd (abfd, info, hppa_link_hash_table (info)))
+ if (! get_opd (abfd, info, hppa_info))
return FALSE;
s = bfd_make_section_with_flags (abfd, ".rela.dlt",
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3))
return FALSE;
- hppa_link_hash_table (info)->dlt_rel_sec = s;
+ hppa_info->dlt_rel_sec = s;
s = bfd_make_section_with_flags (abfd, ".rela.plt",
(SEC_ALLOC | SEC_LOAD
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3))
return FALSE;
- hppa_link_hash_table (info)->plt_rel_sec = s;
+ hppa_info->plt_rel_sec = s;
s = bfd_make_section_with_flags (abfd, ".rela.data",
(SEC_ALLOC | SEC_LOAD
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3))
return FALSE;
- hppa_link_hash_table (info)->other_rel_sec = s;
+ hppa_info->other_rel_sec = s;
s = bfd_make_section_with_flags (abfd, ".rela.opd",
(SEC_ALLOC | SEC_LOAD
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3))
return FALSE;
- hppa_link_hash_table (info)->opd_rel_sec = s;
+ hppa_info->opd_rel_sec = s;
return TRUE;
}
bfd_boolean dynamic_symbol, shared;
hppa_info = hppa_link_hash_table (x->info);
+ if (hppa_info == NULL)
+ return FALSE;
+
dynamic_symbol = elf64_hppa_dynamic_symbol_p (eh, x->info);
shared = x->info->shared;
bfd_boolean reltext;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
struct elf64_hppa_link_hash_table *hppa_info;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
stub = hppa_info->stub_sec;
splt = hppa_info->plt_sec;
asection *sopdrel;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
+
sopd = hppa_info->opd_sec;
sopdrel = hppa_info->opd_rel_sec;
asection *sdlt, *sdltrel;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
sdlt = hppa_info->dlt_sec;
sdltrel = hppa_info->dlt_rel_sec;
int dynindx;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
/* We may need to do a relocation against a local symbol, in
which case we have to look up it's dynamic symbol index off
struct elf64_hppa_link_hash_table *hppa_info;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
/* Finalize the contents of the .opd section. */
elf_link_hash_traverse (elf_hash_table (info),
bfd_boolean retval;
struct elf64_hppa_link_hash_table *hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
+
if (! info->relocatable)
{
struct elf_link_hash_entry *gp;
unsigned int r_type = howto->type;
bfd_byte *hit_data = contents + offset;
+ if (hppa_info == NULL)
+ return bfd_reloc_notsupported;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
local_offsets = elf_local_got_offsets (input_bfd);
insn = bfd_get_32 (input_bfd, hit_data);
struct elf64_hppa_link_hash_table *hppa_info;
hppa_info = hppa_link_hash_table (info);
+ if (hppa_info == NULL)
+ return FALSE;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
rel = relocs;
#define is_ppc64_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
- && elf_object_id (bfd) == PPC64_ELF_TDATA)
+ && elf_object_id (bfd) == PPC64_ELF_DATA)
/* Override the generic function because we store some extras. */
ppc64_elf_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct ppc64_elf_obj_tdata),
- PPC64_ELF_TDATA);
+ PPC64_ELF_DATA);
}
/* Fix bad default arch selected for a 64 bit input bfd when the
/* Get the ppc64 ELF linker hash table from a link_info structure. */
#define ppc_hash_table(p) \
- ((struct ppc_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == PPC64_ELF_DATA ? ((struct ppc_link_hash_table *) ((p)->hash)) : NULL)
#define ppc_stub_hash_lookup(table, string, create, copy) \
((struct ppc_stub_hash_entry *) \
return NULL;
if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc,
- sizeof (struct ppc_link_hash_entry)))
+ sizeof (struct ppc_link_hash_entry),
+ PPC64_ELF_DATA))
{
free (htab);
return NULL;
linker created stub bfd. This ensures that the GOT header is at
the start of the output TOC section. */
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return;
htab->stub_bfd = abfd;
htab->elf.dynobj = abfd;
}
flagword flags;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Create .sfpr for code to save and restore fp regs. */
flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
if (!is_ppc64_elf (abfd))
return FALSE;
+ if (htab == NULL)
+ return FALSE;
if (!htab->got)
{
return FALSE;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!htab->got)
htab->got = bfd_get_section_by_name (dynobj, ".got");
htab->plt = bfd_get_section_by_name (dynobj, ".plt");
abort ();
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
fdh = lookup_fdh (eh, htab);
if (fdh == NULL)
{
struct ppc_link_hash_table *htab;
struct ppc_link_hash_entry **p, *eh;
- htab = ppc_hash_table (info);
if (!is_ppc64_elf (info->output_bfd))
return TRUE;
+ htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (is_ppc64_elf (ibfd))
{
ppc64_elf_as_needed_cleanup (bfd *ibfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- ppc_hash_table (info)->dot_syms = NULL;
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+
+ if (htab == NULL)
+ return FALSE;
+
+ htab->dot_syms = NULL;
return TRUE;
}
BFD_ASSERT (is_ppc64_elf (abfd));
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
FALSE, FALSE, TRUE);
dottga = elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
struct ppc_link_hash_table *htab = ppc_hash_table (info);
struct bfd_sym_chain *sym;
+ if (htab == NULL)
+ return;
+
for (sym = info->gc_sym_list; sym != NULL; sym = sym->next)
{
struct ppc_link_hash_entry *eh, *fh;
elf_section_data (sec)->local_dynrel = NULL;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
local_got_ents = elf_local_got_ents (abfd);
/* Auto-generate _save*, _rest* functions in .sfpr. */
-static unsigned int
+static bfd_boolean
sfpr_define (struct bfd_link_info *info, const struct sfpr_def_parms *parm)
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
bfd_boolean writing = FALSE;
char sym[16];
+ if (htab == NULL)
+ return FALSE;
+
memcpy (sym, parm->name, len);
sym[len + 2] = 0;
info = inf;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Resolve undefined references to dot-symbols as the value
in the function descriptor, if we have one in a regular object.
};
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (htab->sfpr == NULL)
/* We don't have any relocs. */
return TRUE;
asection *s;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Deal with function syms. */
if (h->type == STT_FUNC
save = *p;
*(char *) p = '.';
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return;
+
fh = (struct ppc_link_hash_entry *)
elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE);
*(char *) p = save;
if (h != NULL
&& h->root.root.string[0] == '.')
{
- fdh = lookup_fdh ((struct ppc_link_hash_entry *) h,
- ppc_hash_table (info));
+ struct ppc_link_hash_table *htab;
+
+ htab = ppc_hash_table (info);
+ if (htab != NULL)
+ fdh = lookup_fdh ((struct ppc_link_hash_entry *) h,
+ htab);
if (fdh != NULL
&& fdh->elf.root.type != bfd_link_hash_defined
&& fdh->elf.root.type != bfd_link_hash_defweak)
struct ppc_link_hash_table *htab;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return NULL;
+
htab->tls_get_addr = ((struct ppc_link_hash_entry *)
elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
FALSE, FALSE, TRUE));
return TRUE;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
Elf_Internal_Sym *locsyms = NULL;
info = (struct bfd_link_info *) inf;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if ((htab->elf.dynamic_sections_created
&& h->dynindx != -1
bfd *ibfd;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
if (dynobj == NULL)
abort ();
info = in_arg;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Make a note of the offset within the stubs for this entry. */
stub_entry->stub_offset = stub_entry->stub_sec->size;
info = in_arg;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (stub_entry->stub_type == ppc_stub_plt_call)
{
bfd_size_type amt;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return -1;
/* Stash our params away. */
htab->add_stub_section = add_stub_section;
htab->layout_sections_again = layout_sections_again;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
bfd_vma addr, off;
+ if (htab == NULL)
+ return FALSE;
+
if (!htab->second_toc_pass)
{
/* Keep track of the first .toc or .got section for this input bfd. */
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return;
+
/* After the second pass, toc_curr tracks the TOC offset used
for code sections below in ppc64_elf_next_input_section. */
htab->toc_curr = TOC_BASE_OFF;
local_syms = NULL;
ret = 0;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return -1;
+
for (rel = relstart; rel < relstart + isec->reloc_count; ++rel)
{
enum elf_ppc64_reloc_type r_type;
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if ((isec->output_section->flags & SEC_CODE) != 0
&& isec->output_section->index <= htab->top_index)
{
bfd_boolean stubs_always_before_branch;
struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
stubs_always_before_branch = group_size < 0;
if (group_size < 0)
stub_group_size = -group_size;
bfd_byte *p;
int stub_sec_count = 0;
+ if (htab == NULL)
+ return FALSE;
+
htab->emit_stub_syms = emit_stub_syms;
/* Allocate memory to hold the linker stubs. */
ppc64_elf_restore_symbols (struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab = ppc_hash_table (info);
- elf_link_hash_traverse (&htab->elf, undo_symbol_twiddle, info);
+
+ if (htab != NULL)
+ elf_link_hash_traverse (&htab->elf, undo_symbol_twiddle, info);
}
/* What to do when ld finds relocations against symbols defined in
ppc_howto_init ();
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Don't relocate stub sections. */
if (input_section->owner == htab->stub_bfd)
bfd_byte *loc;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
for (ent = h->plt.plist; ent != NULL; ent = ent->next)
if (ent->plt.offset != (bfd_vma) -1)
asection *sdyn;
htab = ppc_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of BFD, the Binary File Descriptor library.
#define is_s390_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == S390_ELF_TDATA)
+ && elf_object_id (bfd) == S390_ELF_DATA)
static bfd_boolean
elf_s390_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata),
- S390_ELF_TDATA);
+ S390_ELF_DATA);
}
static bfd_boolean
/* Get the s390 ELF linker hash table from a link_info structure. */
#define elf_s390_hash_table(p) \
- ((struct elf_s390_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == S390_ELF_DATA ? ((struct elf_s390_link_hash_table *) ((p)->hash)) : NULL)
/* Create an entry in an s390 ELF linker hash table. */
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
- sizeof (struct elf_s390_link_hash_entry)))
+ sizeof (struct elf_s390_link_hash_entry),
+ S390_ELF_DATA))
{
free (ret);
return NULL;
shortcuts to them in our hash table. */
static bfd_boolean
-create_got_section (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+create_got_section (bfd *dynobj,
+ struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
return FALSE;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
hash table. */
static bfd_boolean
-elf_s390_create_dynamic_sections (dynobj, info)
- bfd *dynobj;
- struct bfd_link_info *info;
+elf_s390_create_dynamic_sections (bfd *dynobj,
+ struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!htab->sgot && !create_got_section (dynobj, info))
return FALSE;
table. */
static bfd_boolean
-elf_s390_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf_s390_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
struct elf_s390_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
BFD_ASSERT (is_s390_elf (abfd));
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
asection *sec,
const Elf_Internal_Rela *relocs)
{
+ struct elf_s390_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
if (info->relocatable)
return TRUE;
+ htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
elf_section_data (sec)->local_dynrel = NULL;
symtab_hdr = &elf_symtab_hdr (abfd);
switch (r_type)
{
case R_390_TLS_LDM64:
- if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
- elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
+ if (htab->tls_ldm_got.refcount > 0)
+ htab->tls_ldm_got.refcount -= 1;
break;
case R_390_TLS_GD64:
understand. */
static bfd_boolean
-elf_s390_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
struct elf_s390_link_hash_table *htab;
asection *s;
same memory location for the variable. */
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* We must generate a R_390_COPY reloc to tell the dynamic linker to
copy the initial value out of the dynamic object and into the
dynamic relocs. */
static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+allocate_dynrelocs (struct elf_link_hash_entry *h,
+ void * inf)
{
struct bfd_link_info *info;
struct elf_s390_link_hash_table *htab;
info = (struct bfd_link_info *) inf;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0)
/* Set the sizes of the dynamic sections. */
static bfd_boolean
-elf_s390_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
bfd *dynobj;
bfd *ibfd;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
if (dynobj == NULL)
abort ();
/* Relocate a 390 ELF section. */
static bfd_boolean
-elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
+elf_s390_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
struct elf_s390_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
BFD_ASSERT (is_s390_elf (input_bfd));
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
dynamic sections here. */
static bfd_boolean
-elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf_s390_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (h->plt.offset != (bfd_vma) -1)
{
/* Finish up the dynamic sections. */
static bfd_boolean
-elf_s390_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf_s390_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
bfd *dynobj;
asection *sdyn;
htab = elf_s390_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
/* SuperH SH64-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
struct elf_sh64_pcrel_relocs_copied *pcrel_relocs_copied;
};
-/* sh ELF linker hash table. */
-
-struct elf_sh64_link_hash_table
-{
- struct elf_link_hash_table root;
-};
-
/* Traverse an sh ELF linker hash table. */
-#define sh64_elf64_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
+#define sh64_elf64_link_hash_traverse(table, func, info) \
+ (elf_link_hash_traverse \
+ ((table), \
(bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info)))
-/* Get the sh ELF linker hash table from a link_info structure. */
-
-#define sh64_elf64_hash_table(p) \
- ((struct elf_sh64_link_hash_table *) ((p)->hash))
-
static bfd_reloc_status_type sh_elf64_ignore_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type sh_elf64_reloc
static struct bfd_link_hash_table *
sh64_elf64_link_hash_table_create (bfd *abfd)
{
- struct elf_sh64_link_hash_table *ret;
+ struct elf_link_hash_table *ret;
- ret = ((struct elf_sh64_link_hash_table *)
- bfd_malloc (sizeof (struct elf_sh64_link_hash_table)));
- if (ret == (struct elf_sh64_link_hash_table *) NULL)
+ ret = (struct elf_link_hash_table *) bfd_malloc (sizeof (* ret));
+ if (ret == (struct elf_link_hash_table *) NULL)
return NULL;
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ if (!_bfd_elf_link_hash_table_init (ret, abfd,
sh64_elf64_link_hash_newfunc,
- sizeof (struct elf_sh64_link_hash_entry)))
+ sizeof (struct elf_sh64_link_hash_entry),
+ GENERIC_ELF_DATA))
{
free (ret);
return NULL;
}
- return &ret->root.root;
+ return &ret->root;
}
inline static void
We allocated space for them in the check_relocs routine, but we
will not fill them in in the relocate_section routine. */
if (info->shared && info->symbolic)
- sh64_elf64_link_hash_traverse (sh64_elf64_hash_table (info),
+ sh64_elf64_link_hash_traverse (elf_hash_table (info),
sh64_elf64_discard_copies, NULL);
/* The check_relocs and adjust_dynamic_symbol entry points have
/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
This file is part of BFD, the Binary File Descriptor library.
#define is_x86_64_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == X86_64_ELF_TDATA)
+ && elf_object_id (bfd) == X86_64_ELF_DATA)
static bfd_boolean
elf64_x86_64_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf64_x86_64_obj_tdata),
- X86_64_ELF_TDATA);
+ X86_64_ELF_DATA);
}
/* x86-64 ELF linker hash table. */
asection *sdynbss;
asection *srelbss;
- /* The offset into splt of the PLT entry for the TLS descriptor
- resolver. Special values are 0, if not necessary (or not found
- to be necessary yet), and -1 if needed but not determined
- yet. */
- bfd_vma tlsdesc_plt;
- /* The offset into sgot of the GOT entry used by the PLT entry
- above. */
- bfd_vma tlsdesc_got;
-
- union {
+ union
+ {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ld_got;
/* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table;
- void *loc_hash_memory;
+ void * loc_hash_memory;
+
+ /* The offset into splt of the PLT entry for the TLS descriptor
+ resolver. Special values are 0, if not necessary (or not found
+ to be necessary yet), and -1 if needed but not determined
+ yet. */
+ bfd_vma tlsdesc_plt;
+ /* The offset into sgot of the GOT entry used by the PLT entry
+ above. */
+ bfd_vma tlsdesc_got;
};
/* Get the x86-64 ELF linker hash table from a link_info structure. */
#define elf64_x86_64_hash_table(p) \
- ((struct elf64_x86_64_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == X86_64_ELF_DATA ? ((struct elf64_x86_64_link_hash_table *) ((p)->hash)) : NULL)
#define elf64_x86_64_compute_jump_table_size(htab) \
((htab)->elf.srelplt->reloc_count * GOT_ENTRY_SIZE)
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
elf64_x86_64_link_hash_newfunc,
- sizeof (struct elf64_x86_64_link_hash_entry)))
+ sizeof (struct elf64_x86_64_link_hash_entry),
+ X86_64_ELF_DATA))
{
free (ret);
return NULL;
ret->tls_ld_got.refcount = 0;
ret->sgotplt_jump_table_size = 0;
ret->tls_module_base = NULL;
-
+
ret->loc_hash_table = htab_try_create (1024,
elf64_x86_64_local_htab_hash,
elf64_x86_64_local_htab_eq,
return FALSE;
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
if (!info->shared)
htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
name = h->root.root.string;
else
{
- Elf_Internal_Sym *isym;
struct elf64_x86_64_link_hash_table *htab;
+
htab = elf64_x86_64_hash_table (info);
- isym = bfd_sym_from_r_symndx (&htab->sym_cache,
- abfd, r_symndx);
- name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
+ if (htab == NULL)
+ name = "*unknown*";
+ else
+ {
+ Elf_Internal_Sym *isym;
+
+ isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ abfd, r_symndx);
+ name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
+ }
}
(*_bfd_error_handler)
BFD_ASSERT (is_x86_64_elf (abfd));
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
symtab_hdr = &elf_symtab_hdr (abfd);
sym_hashes = elf_sym_hashes (abfd);
asection *sec,
const Elf_Internal_Rela *relocs)
{
+ struct elf64_x86_64_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
if (info->relocatable)
return TRUE;
+ htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
elf_section_data (sec)->local_dynrel = NULL;
symtab_hdr = &elf_symtab_hdr (abfd);
switch (r_type)
{
case R_X86_64_TLSLD:
- if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0)
- elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1;
+ if (htab->tls_ld_got.refcount > 0)
+ htab->tls_ld_got.refcount -= 1;
break;
case R_X86_64_TLSGD:
same memory location for the variable. */
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* We must generate a R_X86_64_COPY reloc to tell the dynamic linker
to copy the initial value out of the dynamic object and into the
info = (struct bfd_link_info *) inf;
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
bfd *ibfd;
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
if (dynobj == NULL)
abort ();
if (tlsbase && tlsbase->type == STT_TLS)
{
+ struct elf64_x86_64_link_hash_table *htab;
struct bfd_link_hash_entry *bh = NULL;
const struct elf_backend_data *bed
= get_elf_backend_data (output_bfd);
+ htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
if (!(_bfd_generic_link_add_one_symbol
(info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
tls_sec, 0, NULL, FALSE,
bed->collect, &bh)))
return FALSE;
- elf64_x86_64_hash_table (info)->tls_module_base = bh;
+ htab->tls_module_base = bh;
tlsbase = (struct elf_link_hash_entry *)bh;
tlsbase->def_regular = 1;
static void
elf64_x86_64_set_tls_module_base (struct bfd_link_info *info)
{
+ struct elf64_x86_64_link_hash_table *htab;
struct bfd_link_hash_entry *base;
if (!info->executable)
return;
- base = elf64_x86_64_hash_table (info)->tls_module_base;
+ htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return;
- if (!base)
+ base = htab->tls_module_base;
+ if (base == NULL)
return;
- base->u.def.value = elf_hash_table (info)->tls_size;
+ base->u.def.value = htab->elf.tls_size;
}
/* Return the base VMA address which should be subtracted from real addresses
BFD_ASSERT (is_x86_64_elf (input_bfd));
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
struct elf64_x86_64_link_hash_table *htab;
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
if (h->plt.offset != (bfd_vma) -1)
{
asection *sdyn;
htab = elf64_x86_64_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
- unsigned int entsize)
+ unsigned int entsize,
+ enum elf_target_id target_id)
{
bfd_boolean ret;
int can_refcount = get_elf_backend_data (abfd)->can_refcount;
table->dynsymcount = 1;
ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
+
table->root.type = bfd_link_elf_hash_table;
+ table->hash_table_id = target_id;
return ret;
}
return NULL;
if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc,
- sizeof (struct elf_link_hash_entry)))
+ sizeof (struct elf_link_hash_entry),
+ GENERIC_ELF_DATA))
{
free (ret);
return NULL;
/* IA-64 support for 64-bit ELF
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
typedef struct bfd_hash_entry *(*new_hash_entry_func)
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
/* In dynamically (linker-) created sections, we generally need to keep track
of the place a symbol or expression got allocated to. This is done via hash
/* The main hash table. */
struct elf_link_hash_table root;
- asection *fptr_sec; /* function descriptor table (or NULL) */
- asection *rel_fptr_sec; /* dynamic relocation section for same */
- asection *pltoff_sec; /* private descriptors for plt (or NULL) */
- asection *rel_pltoff_sec; /* dynamic relocation section for same */
+ asection *fptr_sec; /* Function descriptor table (or NULL). */
+ asection *rel_fptr_sec; /* Dynamic relocation section for same. */
+ asection *pltoff_sec; /* Private descriptors for plt (or NULL). */
+ asection *rel_pltoff_sec; /* Dynamic relocation section for same. */
- bfd_size_type minplt_entries; /* number of minplt entries */
- unsigned reltext : 1; /* are there relocs against readonly sections? */
- unsigned self_dtpmod_done : 1;/* has self DTPMOD entry been finished? */
- bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry */
+ bfd_size_type minplt_entries; /* Number of minplt entries. */
+ unsigned reltext : 1; /* Are there relocs against readonly sections? */
+ unsigned self_dtpmod_done : 1;/* Has self DTPMOD entry been finished? */
+ bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry. */
/* There are maybe R_IA64_GPREL22 relocations, including those
optimized from R_IA64_LTOFF22X, against non-SHF_IA_64_SHORT
sections. We need to record those sections so that we can choose
a proper GP to cover all R_IA64_GPREL22 relocations. */
- asection *max_short_sec; /* maximum short output section */
- bfd_vma max_short_offset; /* maximum short offset */
- asection *min_short_sec; /* minimum short output section */
- bfd_vma min_short_offset; /* minimum short offset */
+ asection *max_short_sec; /* Maximum short output section. */
+ bfd_vma max_short_offset; /* Maximum short offset. */
+ asection *min_short_sec; /* Minimum short output section. */
+ bfd_vma min_short_offset; /* Minimum short offset. */
htab_t loc_hash_table;
void *loc_hash_memory;
};
#define elfNN_ia64_hash_table(p) \
- ((struct elfNN_ia64_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == IA64_ELF_DATA ? ((struct elfNN_ia64_link_hash_table *) ((p)->hash)) : NULL)
static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
(struct elfNN_ia64_link_hash_table *ia64_info,
|| (link_info->relax_pass == 1 && sec->skip_relax_pass_1))
return TRUE;
+ ia64_info = elfNN_ia64_hash_table (link_info);
+ if (ia64_info == NULL)
+ return FALSE;
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* Load the relocations for this section. */
internal_relocs = (_bfd_elf_link_read_relocs
- (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+ (abfd, sec, NULL, (Elf_Internal_Rela *) NULL,
link_info->keep_memory));
if (internal_relocs == NULL)
return FALSE;
- ia64_info = elfNN_ia64_hash_table (link_info);
irelend = internal_relocs + sec->reloc_count;
/* Get the section contents. */
derived hash table to keep information specific to the IA-64 ElF
linker (without using static variables). */
-static struct bfd_link_hash_table*
+static struct bfd_link_hash_table *
elfNN_ia64_hash_table_create (bfd *abfd)
{
struct elfNN_ia64_link_hash_table *ret;
ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
if (!ret)
- return 0;
+ return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elfNN_ia64_new_elf_hash_entry,
- sizeof (struct elfNN_ia64_link_hash_entry)))
+ sizeof (struct elfNN_ia64_link_hash_entry),
+ IA64_ELF_DATA))
{
free (ret);
- return 0;
+ return NULL;
}
ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash,
if (!ret->loc_hash_table || !ret->loc_hash_memory)
{
free (ret);
- return 0;
+ return NULL;
}
return &ret->root.root;
return FALSE;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
{
flagword flags = bfd_get_section_flags (abfd, ia64_info->root.sgot);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
got = fptr = srel = pltoff = NULL;
static bfd_boolean
allocate_global_data_got (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
struct elfNN_ia64_link_hash_table *ia64_info;
ia64_info = elfNN_ia64_hash_table (x->info);
+ if (ia64_info == NULL)
+ return FALSE;
+
if (ia64_info->self_dtpmod_offset == (bfd_vma) -1)
{
ia64_info->self_dtpmod_offset = x->ofs;
static bfd_boolean
allocate_global_fptr_got (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
bfd_boolean dynamic_symbol, shared, resolved_zero;
ia64_info = elfNN_ia64_hash_table (x->info);
+ if (ia64_info == NULL)
+ return FALSE;
/* Note that this can't be used in relation to FPTR relocs below. */
dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0);
dynobj = elf_hash_table(info)->dynobj;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
ia64_info->self_dtpmod_offset = (bfd_vma) -1;
BFD_ASSERT(dynobj != NULL);
data.info = info;
bfd_vma got_offset;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return 0;
+
got_sec = ia64_info->root.sgot;
switch (dyn_r_type)
asection *fptr_sec;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return 0;
+
fptr_sec = ia64_info->fptr_sec;
if (!dyn_i->fptr_done)
asection *pltoff_sec;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return 0;
+
pltoff_sec = ia64_info->pltoff_sec;
/* Don't do anything if this symbol uses a real PLT entry. In
struct elfNN_ia64_link_hash_table *ia64_info;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
/* Find the min and max vma of all sections marked short. Also collect
min and max vma of any type, for use in selecting a nice gp. */
asection *unwind_output_sec;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
/* Make sure we've got ourselves a nice fat __gp value. */
if (!info->relocatable)
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
/* Infect various flags from the input section to the output section. */
if (info->relocatable)
struct elfNN_ia64_dyn_sym_info *dyn_i;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
+
dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, FALSE);
/* Fill in the PLT data, if required. */
bfd *dynobj;
ia64_info = elfNN_ia64_hash_table (info);
+ if (ia64_info == NULL)
+ return FALSE;
+
dynobj = ia64_info->root.dynobj;
if (elf_hash_table (info)->dynamic_sections_created)
/* MIPS-specific support for ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
#define is_mips_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == MIPS_ELF_TDATA)
+ && elf_object_id (bfd) == MIPS_ELF_DATA)
/* The ABI says that every symbol used by dynamic relocations must have
a global GOT entry. Among other things, this provides the dynamic
asection *(*add_stub_section) (const char *, asection *, asection *);
};
+/* Get the MIPS ELF linker hash table from a link_info structure. */
+
+#define mips_elf_hash_table(p) \
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == MIPS_ELF_DATA ? ((struct mips_elf_link_hash_table *) ((p)->hash)) : NULL)
+
/* A structure used to communicate with htab_traverse callbacks. */
-struct mips_htab_traverse_info {
+struct mips_htab_traverse_info
+{
/* The usual link-wide information. */
struct bfd_link_info *info;
bfd *output_bfd;
(bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info)))
-/* Get the MIPS ELF linker hash table from a link_info structure. */
-
-#define mips_elf_hash_table(p) \
- ((struct mips_elf_link_hash_table *) ((p)->hash))
-
/* Find the base offsets for thread-local storage in this object,
for GD/LD and IE/LE respectively. */
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
htab->add_stub_section = fn;
htab->la25_stubs = htab_try_create (1, mips_elf_la25_stub_hash,
mips_elf_la25_stub_eq, NULL);
unsigned int align;
htab = mips_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Create a unique name for the new section. */
name = bfd_malloc (11 + sizeof (".text.stub."));
asection *s;
htab = mips_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
/* Create a trampoline section, if we haven't already. */
s = htab->strampoline;
/* See if we've already created an equivalent stub. */
htab = mips_elf_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
slot = htab_find_slot (htab->la25_stubs, &search, INSERT);
if (slot == NULL)
return FALSE;
bfd_boolean need_relocs = FALSE;
htab = mips_elf_hash_table (info);
+ if (htab == NULL)
+ return;
+
sgot = htab->sgot;
indx = 0;
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
BFD_ASSERT (h->plt.offset != (bfd_vma) -1);
/* This function only works for VxWorks, because a non-VxWorks .got.plt
struct mips_got_entry *entry;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
entry = mips_elf_create_local_got_entry (abfd, info, ibfd, value,
r_symndx, h, r_type);
if (!entry)
long global_got_dynindx = 0;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
gg = g = htab->got_info;
if (g->bfd2got && ibfd)
{
bfd_vma gp;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
sgot = htab->sgot;
gp = _bfd_get_gp_value (output_bfd)
+ mips_elf_adjust_gp (output_bfd, htab->got_info, input_bfd);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
entry.abfd = NULL;
entry.symndx = -1;
return TRUE;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
g = htab->got_info;
if (g == NULL)
return TRUE;
struct mips_got_info *g;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
hmips = (struct mips_elf_link_hash_entry *) h;
/* A global symbol in the GOT must also be in the dynamic symbol
struct mips_got_entry entry, **loc;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
g = htab->got_info;
BFD_ASSERT (g != NULL);
void **loc;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
g = htab->got_info;
BFD_ASSERT (g != NULL);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
s = mips_elf_rel_dyn_section (info, FALSE);
BFD_ASSERT (s != NULL);
entry = (struct mips_got_entry *) *entryp;
info = (struct bfd_link_info *) data;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (entry->abfd != NULL
&& entry->symndx == -1
&& entry->d.h->needs_lazy_stub)
dynobj = elf_hash_table (info)->dynobj;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
g = htab->got_info;
g->bfd2got = htab_try_create (1, mips_elf_bfd2got_entry_hash,
mips_elf_bfd2got_entry_eq, NULL);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* This function may be called more than once. */
if (htab->sgot)
dynobj = elf_hash_table (info)->dynobj;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* Parse the relocation. */
r_symndx = ELF_R_SYM (input_bfd, relocation->r_info);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
r_type = ELF_R_TYPE (output_bfd, rel->r_info);
dynobj = elf_hash_table (info)->dynobj;
sreloc = mips_elf_rel_dyn_section (info, FALSE);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED | SEC_READONLY);
return TRUE;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
dynobj = elf_hash_table (info)->dynobj;
hmips = (struct mips_elf_link_hash_entry *) h;
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
dynobj = elf_hash_table (info)->dynobj;
hmips = (struct mips_elf_link_hash_entry *) h;
struct mips_htab_traverse_info hti;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* The .reginfo section has a fixed size. */
ri = bfd_get_section_by_name (output_bfd, ".reginfo");
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
s = htab->sgot;
if (s == NULL)
return TRUE;
bfd_size_type dynsymcount;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (htab->lazy_stub_count == 0)
return;
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (htab->lazy_stub_count == 0)
return;
htab->sstubs->size = 0;
- mips_elf_link_hash_traverse (mips_elf_hash_table (info),
- mips_elf_allocate_lazy_stub, htab);
+ mips_elf_link_hash_traverse (htab, mips_elf_allocate_lazy_stub, htab);
htab->sstubs->size += htab->function_stub_size;
BFD_ASSERT (htab->sstubs->size
== htab->lazy_stub_count * htab->function_stub_size);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
BFD_ASSERT (name != NULL);
if (!htab->small_data_overflow_reported
&& (howto->type == R_MIPS_GPREL16
stub = (struct mips_elf_la25_stub *) *slot;
hti = (struct mips_htab_traverse_info *) data;
htab = mips_elf_hash_table (hti->info);
+ BFD_ASSERT (htab != NULL);
/* Create the section contents, if we haven't already. */
s = stub->stub_section;
struct mips_elf_link_hash_entry *hmips;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = elf_hash_table (info)->dynobj;
hmips = (struct mips_elf_link_hash_entry *) h;
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = elf_hash_table (info)->dynobj;
if (h->plt.offset != (bfd_vma) -1)
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (ABI_64_P (output_bfd))
plt_entry = mips_n64_exec_plt0_entry;
else if (ABI_N32_P (output_bfd))
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
plt_entry = mips_vxworks_exec_plt0_entry;
/* Calculate the value of _GLOBAL_OFFSET_TABLE_. */
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
/* We just need to copy the entry byte-by-byte. */
for (i = 0; i < ARRAY_SIZE (mips_vxworks_shared_plt0_entry); i++)
struct mips_elf_link_hash_table *htab;
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
dynobj = elf_hash_table (info)->dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
_bfd_mips_elf_mkobject (bfd *abfd)
{
return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
- MIPS_ELF_TDATA);
+ MIPS_ELF_DATA);
}
/* Create a MIPS ELF linker hash table. */
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
mips_elf_link_hash_newfunc,
- sizeof (struct mips_elf_link_hash_entry)))
+ sizeof (struct mips_elf_link_hash_entry),
+ MIPS_ELF_DATA))
{
free (ret);
return NULL;
/* Sort the dynamic symbols so that those with GOT entries come after
those without. */
htab = mips_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
+
if (!mips_elf_sort_hash_table (abfd, info))
return FALSE;
if (link_info)
{
htab = mips_elf_hash_table (link_info);
+ BFD_ASSERT (htab != NULL);
+
if (htab->use_plts_and_copy_relocs && !htab->is_vxworks)
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
/* 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.
#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
}
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;
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);
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;
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);
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);
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
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)
bfd *ibfd;
htab = _bfd_sparc_elf_hash_table (info);
+ BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj;
BFD_ASSERT (dynobj != NULL);
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);
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;
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);
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;
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
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);
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");
/* SPARC ELF specific backend routines.
- Copyright 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
asection *sdynbss;
asection *srelbss;
- union {
+ union
+ {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
/* Get the SPARC ELF linker hash table from a link_info structure. */
#define _bfd_sparc_elf_hash_table(p) \
- ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash))
+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+ == SPARC_ELF_DATA ? ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash)) : NULL)
extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
(bfd *, bfd_reloc_code_real_type);
+2010-02-03 Nick Clifton <nickc@redhat.com>
+
+ * 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.
+
2010-02-03 Alan Modra <amodra@gmail.com>
* emultempl/ppc64elf.em (build_toc_list): Report errors from
alpha_after_open (void)
{
if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
- && elf_object_id (link_info.output_bfd) == ALPHA_ELF_TDATA)
+ && elf_object_id (link_info.output_bfd) == ALPHA_ELF_DATA)
{
unsigned int num_plt;
lang_output_section_statement_type *os;
hppaelf_create_output_section_statements (void)
{
if (!(bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
- && elf_object_id (link_info.output_bfd) == HPPA_ELF_TDATA))
+ && (elf_object_id (link_info.output_bfd) == HPPA32_ELF_DATA
+ || elf_object_id (link_info.output_bfd) == HPPA64_ELF_DATA)))
return;
stub_file = lang_add_input_file ("linker stubs",
#define is_mips_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
- && elf_object_id (bfd) == MIPS_ELF_TDATA)
+ && elf_object_id (bfd) == MIPS_ELF_DATA)
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
#define is_ppc_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
- && elf_object_id (bfd) == PPC32_ELF_TDATA)
+ && elf_object_id (bfd) == PPC32_ELF_DATA)
/* Whether to run tls optimization. */
static int notlsopt = 0;
ppc_create_output_section_statements (void)
{
if (!(bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
- && elf_object_id (link_info.output_bfd) == PPC64_ELF_TDATA))
+ && elf_object_id (link_info.output_bfd) == PPC64_ELF_DATA))
return;
link_info.wrap_char = '.';