From 9637f6ef78ecc63d9fca3ccffe825fb8e908a575 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 2 Sep 2012 12:17:27 +0000 Subject: 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. --- bfd/ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ bfd/elf-bfd.h | 3 +++ bfd/elf-m10300.c | 2 +- bfd/elf32-arm.c | 2 +- bfd/elf32-cr16.c | 2 +- bfd/elf32-cris.c | 2 +- bfd/elf32-hppa.c | 4 +--- bfd/elf32-i386.c | 2 +- bfd/elf32-lm32.c | 3 +-- bfd/elf32-m32r.c | 3 +-- bfd/elf32-microblaze.c | 6 +++--- bfd/elf32-s390.c | 2 +- bfd/elf32-score.c | 3 ++- bfd/elf32-score7.c | 3 ++- bfd/elf32-sh.c | 2 +- bfd/elf32-tic6x.c | 2 +- bfd/elf32-tilepro.c | 2 +- bfd/elf32-vax.c | 2 +- bfd/elf32-xtensa.c | 2 +- bfd/elf64-aarch64.c | 2 +- bfd/elf64-alpha.c | 2 +- bfd/elf64-ia64-vms.c | 2 +- bfd/elf64-s390.c | 2 +- bfd/elf64-sh64.c | 2 +- bfd/elf64-x86-64.c | 2 +- bfd/elflink.c | 5 ++++- bfd/elfnn-ia64.c | 2 +- bfd/elfxx-mips.c | 2 +- bfd/elfxx-sparc.c | 2 +- bfd/elfxx-tilegx.c | 2 +- 30 files changed, 78 insertions(+), 34 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d545c1d..ee99372 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,43 @@ +2012-09-02 H.J. Lu + + * 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 * elf32-i386.c (elf_i386_convert_mov_to_lea): Don't optimize diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index e57528e..1225036 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -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; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 709ea16..b44a4b4 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -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; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index a287fbb..633bb64 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 97fa569..46769f5 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -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; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index c9316ee..33afc63 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -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; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index dc3053c..7ec06c7 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -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; } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index eab963c..25e3a33 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -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) diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 8d530a4..f40536c 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -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; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index e3e3bb0..70ddaab 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -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; diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 27b569e..c000424 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -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; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 8d654d5..039de3a 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -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; diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 01a602b..7b16ea2 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -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) { diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 3615a1e..30bfe39 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -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) { diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index cbd00aa..df4affd 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -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; diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index dbe2c16..ef0d155 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -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; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index aa2dfd6..cbb65c6 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -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; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 6258d96..3fbc289 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -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; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 2de9480..797979f 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -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; diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c index 6299074..648ca7f 100644 --- a/bfd/elf64-aarch64.c +++ b/bfd/elf64-aarch64.c @@ -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; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index deb03c1..c18c37a 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -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; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index f723068..85a6192 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -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; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 8512fc0..c8b57f4 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -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; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index ce5436d..3e6d081 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -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; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 9edc5ae..7daecb4 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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) diff --git a/bfd/elflink.c b/bfd/elflink.c index 3ef3f9b..9446e7d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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) diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index e6abb79..afa1e04 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -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; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 9c3f372..15a32c1 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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 diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index e14afaf..9811d17 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -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; diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index c0daf18..3bcdd3a 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -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; -- cgit v1.1