This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
A new visibility patch
- To: loewis at informatik dot hu-berlin dot de
- Subject: A new visibility patch
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Sat, 20 May 2000 22:59:01 -0700
- Cc: binutils at sourceware dot cygnus dot com
This patch tries to ensure we only set ELF_ST_VISIBILITY in the
binary where the symbol is defined. Martin, any comments?
--
H.J. Lu (hjl@gnu.org)
---
2000-05-20 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_output_extsym): Clear the visibility
field for symbols not defined locally.
Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.26
diff -u -p -r1.26 elflink.h
--- elflink.h 2000/05/18 22:10:35 1.26
+++ elflink.h 2000/05/21 05:54:31
@@ -5089,6 +5089,13 @@ elf_link_output_extsym (h, data)
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
+ /* If a symbol is not defined locally, we clear the visibility
+ field. */
+ if (sym.st_shndx == SHN_UNDEF
+ || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0))
+ sym.st_other &= ~ELF_ST_VISIBILITY(sym.st_other);
+
/* If this symbol should be put in the .dynsym section, then put it
there now. We have already know the symbol index. We also fill
in the entry in the .hash section. */