This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
A patch for elflink.h
- To: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- Subject: A patch for elflink.h
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Fri, 27 Apr 2001 10:31:21 -0700
- Cc: binutils at sourceware dot cygnus dot com, amodra at one dot net dot au
Thanks for the bug report. I believe this patch fixes it. I will check
it in shortly and I will make binutils 2.11.90.0.7 this weekend. I am
also enclosing a testcase here.
H.J.
----
2001-04-27 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_fix_symbol_flags): Hide a symbol if and only
if the symbol has hidden or internal visibility.
Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.85
diff -u -p -r1.85 elflink.h
--- elflink.h 2001/04/13 00:34:35 1.85
+++ elflink.h 2001/04/27 17:13:44
@@ -3528,20 +3528,28 @@ elf_fix_symbol_flags (h, eif)
symbols to the definition within the shared object), and this
symbol was defined in a regular object, then it actually doesn't
need a PLT entry, and we can accomplish that by forcing it local.
- Likewise, if the symbol has hidden or internal visibility.
+ Likewise, if the symbol has hidden or internal visibility. We
+ hide a symbol if and only if the symbol has hidden or internal
+ visibility.
FIXME: It might be that we also do not need a PLT for other
non-hidden visibilities, but we would have to tell that to the
backend specifically; we can't just clear PLT-related data here. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& eif->info->shared
- && (eif->info->symbolic
- || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
{
- struct elf_backend_data *bed;
- bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- (*bed->elf_backend_hide_symbol) (eif->info, h);
+ if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+ || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
+ {
+ struct elf_backend_data *bed;
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ (*bed->elf_backend_hide_symbol) (eif->info, h);
+ }
+ else if (eif->info->symbolic)
+ {
+ h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.offset = (bfd_vma) -1;
+ }
}
/* If this is a weak defined symbol in a dynamic object, and we know
symbolic.tar.gz