From 7c5fcef7ab6d53fff7cc301cb00b8cb9ea1797fe Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 3 May 2002 19:53:20 +0000 Subject: [PATCH] 2002-05-03 H.J. Lu (hjl@gnu.org) * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local. (mips_elf_link_hash_newfunc): Initialize forced_local to false. (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol to hide a global symbol. (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set forced_local to true. --- bfd/ChangeLog | 9 +++++++++ bfd/elfxx-mips.c | 24 +++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dc22fe5..92ff160 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2002-05-03 H.J. Lu (hjl@gnu.org) + + * elfxx-mips.c (mips_elf_link_hash_entry): Add forced_local. + (mips_elf_link_hash_newfunc): Initialize forced_local to false. + (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol + to hide a global symbol. + (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set + forced_local to true. + 2002-05-02 Richard Henderson * elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index c47556f..8ec22b9 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -115,6 +115,9 @@ struct mips_elf_link_hash_entry /* This is like the call_stub field, but it is used if the function being called returns a floating point value. */ asection *call_fp_stub; + + /* Are we forced local? .*/ + boolean forced_local; }; /* MIPS ELF linker hash table. */ @@ -581,6 +584,7 @@ mips_elf_link_hash_newfunc (entry, table, string) ret->need_fn_stub = false; ret->call_stub = NULL; ret->call_fp_stub = NULL; + ret->forced_local = false; } return (struct bfd_hash_entry *) ret; @@ -1685,9 +1689,18 @@ mips_elf_record_global_got_symbol (h, info, g) { /* A global symbol in the GOT must also be in the dynamic symbol table. */ - if (h->dynindx == -1 - && !bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; + if (h->dynindx == -1) + { + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + _bfd_mips_elf_hide_symbol (info, h, true); + break; + } + if (!bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } /* If we've already marked this entry as needing GOT space, we don't need to do it again. */ @@ -6384,7 +6397,12 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) asection *got; struct mips_got_info *g; struct mips_elf_link_hash_entry *h; + h = (struct mips_elf_link_hash_entry *) entry; + if (h->forced_local) + return; + h->forced_local = true; + dynobj = elf_hash_table (info)->dynobj; got = bfd_get_section_by_name (dynobj, ".got"); g = (struct mips_got_info *) elf_section_data (got)->tdata; -- 2.7.4