From ef5aade5aca46a8f4244c7185fecbadbc32e50fa Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 5 May 2003 05:46:53 +0000 Subject: bfd/ 2003-05-04 H.J. Lu * elf32-i386.c (allocate_dynrelocs): Don't allocate dynamic relocation entries for weak undefined symbols with non-default visibility. (elf_i386_relocate_section): Initialize the GOT entries and skip R_386_32/R_386_PC32 for weak undefined symbols with non-default visibility. * elfxx-ia64.c (allocate_fptr): Don't allocate function descriptors for weak undefined symbols with non-default visibility. (allocate_dynrel_entries): Don't allocate relocation entries for symbols resolved to 0. (set_got_entry): Don't install dynamic relocation for weak undefined symbols with non-default visibility. (set_pltoff_entry): Likewise. * elflink.h (elf_fix_symbol_flags): Hide weak undefined symbols with non-default visibility. (elf_link_output_extsym): Don't make weak undefined symbols with non-default visibility dynamic. ld/testsuite/ 2003-05-04 H.J. Lu * ld-elfvsb/main.c: Updated. * ld-elfvsb/sh1.c: Likewise. --- bfd/elflink.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'bfd/elflink.h') diff --git a/bfd/elflink.h b/bfd/elflink.h index dfcce7d..0f590a4 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -4151,6 +4151,16 @@ elf_fix_symbol_flags (h, eif) (*bed->elf_backend_hide_symbol) (eif->info, h, force_local); } + /* If a weak undefined symbol has non-default visibility, we also + hide it from the dynamic linker. */ + if (ELF_ST_VISIBILITY (h->other) + && h->root.type == bfd_link_hash_undefweak) + { + struct elf_backend_data *bed; + bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); + (*bed->elf_backend_hide_symbol) (eif->info, h, TRUE); + } + /* If this is a weak defined symbol in a dynamic object, and we know the real definition in the dynamic object, copy interesting flags over to the real definition. */ @@ -6546,7 +6556,9 @@ elf_link_output_extsym (h, data) forced local syms when non-shared is due to a historical quirk. */ if ((h->dynindx != -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - && (finfo->info->shared + && ((finfo->info->shared + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) && elf_hash_table (finfo->info)->dynamic_sections_created) { -- cgit v1.1