+2012-09-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (elf_link_hash_table): Add hdynamic for the
+ _DYNAMIC symbol.
+
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Set
+ hdynamic.
+
+ * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Check
+ hdynamic instead of "_DYNAMIC".
+ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
+ * elf32-cr16.c (elf32_arm_finish_dynamic_symbol): Likewise.
+ * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_convert_mov_to_lea): Likewise.
+ * elf32-lm32.c (lm32_elf_finish_dynamic_symbol): Likewise.
+ * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
+ * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
+ * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
+ * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
+ * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
+ * elf64-aarch64.c elf64_aarch64_finish_dynamic_symbol(): Likewise.
+ * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
+ * elf64-ia64-vms.c (elf64_ia64_finish_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+ * elfnn-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
+ * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
+
+ * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Check
+ hdynamic, hgot, hplt instead of _DYNAMIC, _GLOBAL_OFFSET_TABLE_,
+ _PROCEDURE_LINKAGE_TABLE_.
+ * elf32-score.c (s3_bfd_score_elf_finish_dynamic_symbol): Likewise.
+ * elf32-score7.c (s7_bfd_score_elf_finish_dynamic_symbol): Likewise.
+
2012-08-31 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_convert_mov_to_lea): Don't optimize
/* The _PROCEDURE_LINKAGE_TABLE_ symbol. */
struct elf_link_hash_entry *hplt;
+ /* The _DYNAMIC symbol. */
+ struct elf_link_hash_entry *hdynamic;
+
/* A pointer to information used to merge SEC_MERGE sections. */
void *merge_info;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (streq (h->root.root.string, "_DYNAMIC")
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks,
the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it is relative
to the ".got" section. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->root.hdynamic
|| (!htab->vxworks_p && h == htab->root.hgot))
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (eh_name (eh)[0] == '_'
- && (strcmp (eh_name (eh), "_DYNAMIC") == 0
- || eh == htab->etab.hgot))
+ if (eh == htab->etab.hdynamic || eh == htab->etab.hgot)
{
sym->st_shndx = SHN_ABS;
}
optimizing _DYNAMIC since ld.so may use its link-time address. */
if (h->def_regular
&& h->type != STT_GNU_IFUNC
- && strcmp (h->root.root.string, "_DYNAMIC") != 0
+ && h != htab->elf.hdynamic
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || h == htab->root.hgot)
+ if (h == htab->root.hdynamic || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || h == htab->root.hgot)
+ if (h == htab->root.hdynamic || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ if (h == htab->elf.hdynamic
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->elf.hdynamic
|| h == htab->elf.hgot
|| h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
name = h->root.root.string;
- if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (h == elf_hash_table (info)->hdynamic
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0)
{
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
name = h->root.root.string;
- if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ if (h == elf_hash_table (info)->hdynamic
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0)
{
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks,
_GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the
".got" section. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->root.hdynamic
|| (!htab->vxworks_p && h == htab->root.hgot))
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->elf.hdynamic
|| (h == htab->elf.hgot || h == htab->elf.hplt))
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. SYM may
be NULL for local symbols. */
if (sym != NULL
- && (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ && (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot))
sym->st_shndx = SHN_ABS;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot
|| h == elf_hash_table (info)->hplt)
sym->st_shndx = SHN_ABS;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == ia64_info->root.hdynamic
|| h == ia64_info->root.hgot
|| h == ia64_info->root.hplt)
sym->st_shndx = SHN_ABS;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->elf.hdynamic
|| h == htab->elf.hgot
|| h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
address. */
if (h->def_regular
&& h->type != STT_GNU_IFUNC
- && strcmp (h->root.root.string, "_DYNAMIC") != 0
+ && h != htab->elf.hdynamic
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
flagword flags;
asection *s;
const struct elf_backend_data *bed;
+ struct elf_link_hash_entry *h;
if (! is_elf_hash_table (info->hash))
return FALSE;
section. We don't want to define it if there is no .dynamic
section, since on some ELF platforms the start up code examines it
to decide how to initialize the process. */
- if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC"))
+ h = _bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC");
+ elf_hash_table (info)->hdynamic = h;
+ if (h == NULL)
return FALSE;
if (info->emit_hash)
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == ia64_info->root.hdynamic
|| h == ia64_info->root.hgot
|| h == ia64_info->root.hplt)
sym->st_shndx = SHN_ABS;
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
name = h->root.root.string;
- if (strcmp (name, "_DYNAMIC") == 0
+ if (h == elf_hash_table (info)->hdynamic
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0
_GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the
".got" section. Likewise _PROCEDURE_LINKAGE_TABLE_ and ".plt". */
if (sym != NULL
- && (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ && (h == htab->elf.hdynamic
|| (!htab->is_vxworks
&& (h == htab->elf.hgot || h == htab->elf.hplt))))
sym->st_shndx = SHN_ABS;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == htab->elf.hdynamic
|| (h == htab->elf.hgot || h == htab->elf.hplt))
sym->st_shndx = SHN_ABS;