From 5fba655aed6c897750c2a9c88467b1691b8ec481 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 30 Apr 2001 16:13:26 +0000 Subject: [PATCH] 2000-04-27 H.J. Lu * elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1 only for ELF_LINK_FORCED_LOCAL. * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise. * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise. * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise. * elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL if the symbol has hidden or internal visibility. --- bfd/ChangeLog | 11 +++++++++++ bfd/elf.c | 3 ++- bfd/elf32-hppa.c | 3 ++- bfd/elf32-mips.c | 3 ++- bfd/elflink.h | 3 +++ bfd/elfxx-ia64.c | 3 ++- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eebb8fa1905..8e6ab54b0cd 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2001-04-30 H.J. Lu + + * elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1 + only for ELF_LINK_FORCED_LOCAL. + * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise. + * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise. + * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise. + + * elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL + if the symbol has hidden or internal visibility. + 2001-04-30 Alan Modra * elf32-hppa.c (final_link_relocate): Branch to .+8 for diff --git a/bfd/elf.c b/bfd/elf.c index 26ce9d3b0a7..602ebcdfcee 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1014,8 +1014,9 @@ _bfd_elf_link_hash_hide_symbol (info, h) struct elf_link_hash_entry *h; { h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - h->dynindx = -1; h->plt.offset = (bfd_vma) -1; + if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + h->dynindx = -1; } /* Initialize an ELF linker hash table. */ diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index fdcb3b4ff7e..02242154529 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1863,7 +1863,8 @@ elf32_hppa_hide_symbol (info, h) struct bfd_link_info *info ATTRIBUTE_UNUSED; struct elf_link_hash_entry *h; { - h->dynindx = -1; + if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + h->dynindx = -1; if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel) { h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index efbcbfab293..065e7d78648 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -4002,7 +4002,8 @@ _bfd_mips_elf_hide_symbol (info, h) h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; h->root.plt.offset = (bfd_vma) -1; - h->root.dynindx = -1; + if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + h->root.dynindx = -1; /* FIXME: Do we allocate too much GOT space here? */ g->local_gotno++; diff --git a/bfd/elflink.h b/bfd/elflink.h index d175223ffa9..4973ae36f21 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -3541,6 +3541,9 @@ elf_fix_symbol_flags (h, eif) { struct elf_backend_data *bed; bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; (*bed->elf_backend_hide_symbol) (eif->info, h); } diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 77d20221d9a..8d80e6e27df 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -1524,7 +1524,8 @@ elfNN_ia64_hash_hide_symbol (info, xh) h = (struct elfNN_ia64_link_hash_entry *)xh; h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - h->root.dynindx = -1; + if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + h->root.dynindx = -1; for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next) dyn_i->want_plt2 = 0; -- 2.30.2