diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-06-09 22:29:42 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-06-09 22:29:42 +0000 |
commit | b087ddea52407e4a9b8fe07d0ad234d36379fb67 (patch) | |
tree | eb75e416899d445ace73b11fb08d1328b3a1f368 /gnu/usr.bin/binutils/bfd/elflink.h | |
parent | fcab77976ead6644881c2eb7bb3499cdfabed685 (diff) |
Automatic cvs merge. Dread what I will have to fix after this excuse
of a program is done...
Diffstat (limited to 'gnu/usr.bin/binutils/bfd/elflink.h')
-rw-r--r-- | gnu/usr.bin/binutils/bfd/elflink.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils/bfd/elflink.h b/gnu/usr.bin/binutils/bfd/elflink.h index bddf2907119..0230892553c 100644 --- a/gnu/usr.bin/binutils/bfd/elflink.h +++ b/gnu/usr.bin/binutils/bfd/elflink.h @@ -1852,6 +1852,18 @@ elf_link_add_object_symbols (abfd, info) goto error_return; } } + else if (dynsym && h->dynindx != -1) + /* If the symbol already has a dynamic index, but + visibility says it should not be visible, turn it into + a local symbol. */ + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + (*bed->elf_backend_hide_symbol) (h); + break; + } } } @@ -3339,10 +3351,12 @@ elf_fix_symbol_flags (h, eif) /* If -Bsymbolic was used (which means to bind references to global 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. */ + need a PLT entry. Likewise, if the symbol has any kind of + visibility (internal, hidden, or protected), it doesn't need a + PLT. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 && eif->info->shared - && eif->info->symbolic + && (eif->info->symbolic || ELF_ST_VISIBILITY (h->other)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) { h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT; @@ -5072,6 +5086,11 @@ 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 ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_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. */ |