--- /dev/null
+2006-12-06 H.J. Lu <hjl@gnu.org>
+
+ PR ld/3666
+ * elflink.c (elf_link_add_object_symbols): Keep symbol
+ visibility for symbols from discarded section.
+
+--- binutils/bfd/elflink.c.merge 2006-12-06 06:43:24.000000000 -0800
++++ binutils/bfd/elflink.c 2006-12-06 07:10:18.000000000 -0800
+@@ -3702,12 +3702,10 @@ elf_link_add_object_symbols (bfd *abfd,
+ sec = bfd_abs_section_ptr;
+ else if (sec->kept_section)
+ {
+- /* Symbols from discarded section are undefined, and have
+- default visibility. */
++ /* Symbols from discarded section are undefined. We keep
++ its visibility. */
+ sec = bfd_und_section_ptr;
+ isym->st_shndx = SHN_UNDEF;
+- isym->st_other = (STV_DEFAULT
+- | (isym->st_other & ~ ELF_ST_VISIBILITY (-1)));
+ }
+ else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ value -= sec->vma;