Add hdynamic to elf_link_hash_table for _DYNAMIC
* 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.
This commit is contained in:
parent
76d4b318d5
commit
9637f6ef78
30 changed files with 78 additions and 34 deletions
|
@ -1,3 +1,43 @@
|
|||
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
|
||||
|
|
|
@ -498,6 +498,9 @@ struct elf_link_hash_table
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -5395,7 +5395,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -14003,7 +14003,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -2698,7 +2698,7 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -2288,7 +2288,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -4442,9 +4442,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
@ -2635,7 +2635,7 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
|
|||
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)
|
||||
|
|
|
@ -1745,8 +1745,7 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -3295,8 +3295,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -2882,9 +2882,9 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -3703,7 +3703,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -3537,7 +3537,8 @@ s3_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
@ -3345,7 +3345,8 @@ s7_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
@ -7157,7 +7157,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -1903,7 +1903,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -3787,7 +3787,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -1908,7 +1908,7 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -3135,7 +3135,7 @@ elf_xtensa_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -6590,7 +6590,7 @@ elf64_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -4902,7 +4902,7 @@ elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -4030,7 +4030,7 @@ elf64_ia64_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -3506,7 +3506,7 @@ do_glob_dat:
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -3769,7 +3769,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -2672,7 +2672,7 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
|
|||
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)
|
||||
|
|
|
@ -187,6 +187,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -254,7 +255,9 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
|||
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)
|
||||
|
|
|
@ -4586,7 +4586,7 @@ elfNN_ia64_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -10129,7 +10129,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
|
||||
/* 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
|
||||
|
|
|
@ -4511,7 +4511,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
_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;
|
||||
|
|
|
@ -4185,7 +4185,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue