From 7a13edea08cb46d90e1512c72540de7d0b1411a5 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 3 Jan 2000 18:32:21 +0000 Subject: ELF visibility patch from Martin Loewis. --- bfd/elflink.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bfd/elflink.c') diff --git a/bfd/elflink.c b/bfd/elflink.c index c30915b..ce78b59 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -218,6 +218,32 @@ _bfd_elf_link_record_dynamic_symbol (info, h) boolean copy; bfd_size_type indx; + /* XXX: The ABI draft says the linker must turn hidden and + internal symbols into STB_LOCAL symbols when producing the + DSO. However, if ld.so honors st_other in the dynamic table, + this would not be necessary. */ + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + /* This symbol must be defined in the shared object or + executable. */ + if (h->root.type == bfd_link_hash_undefined) + { + bfd * abfd = h->root.u.undef.abfd; + char * name = h->root.root.string; + + (*info->callbacks->undefined_symbol) + (info, name, abfd, bfd_und_section_ptr, 0); + } + + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + break; + + default: + break; + } + h->dynindx = elf_hash_table (info)->dynsymcount; ++elf_hash_table (info)->dynsymcount; -- cgit v1.1