bfd/
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 7 Dec 2006 13:32:02 +0000 (13:32 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 7 Dec 2006 13:32:02 +0000 (13:32 +0000)
2006-12-07  H.J. Lu <hjl@gnu.org>

PR ld/3666
* elflink.c (elf_link_add_object_symbols): Keep symbol
visibility for symbols from discarded section.

ld/testsuite/

2006-12-07  H.J. Lu <hjl@gnu.org>

PR ld/3666
* ld-elf/group3a.d: New file.
* ld-elf/group3a.s: Likewise.
* ld-elf/group3b.d: Likewise.
* ld-elf/group3b.s: Likewise.

bfd/ChangeLog
bfd/elflink.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/group3a.d [new file with mode: 0644]
ld/testsuite/ld-elf/group3a.s [new file with mode: 0644]
ld/testsuite/ld-elf/group3b.d [new file with mode: 0644]
ld/testsuite/ld-elf/group3b.s [new file with mode: 0644]

index 8b1911c715c35955570c579d1361fd3c10d66cf4..5e41f1431f1aff4cc2f1c8c539a9dc7fd7ab8250 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-07  H.J. Lu <hjl@gnu.org>
+
+       PR ld/3666
+       * elflink.c (elf_link_add_object_symbols): Keep symbol
+       visibility for symbols from discarded section.
+
 2006-12-06  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-alpha.c (elf64_alpha_merge_symbol_attribute): New function.
index b0227d8bea3930b4a2fff0f49fa2f9c33f15228d..be018babcf7a5ebafadedd173d3f04bafd6688e1 100644 (file)
@@ -3682,12 +3682,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
            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;
index 7b4c64f7e8a80b92f6405a637e4af47fda1b0030..c5d9fb02db1e4c77ff383be89fee723405be12af 100644 (file)
@@ -1,3 +1,11 @@
+2006-12-07  H.J. Lu <hjl@gnu.org>
+
+       PR ld/3666
+       * ld-elf/group3a.d: New file.
+       * ld-elf/group3a.s: Likewise.
+       * ld-elf/group3b.d: Likewise.
+       * ld-elf/group3b.s: Likewise.
+
 2006-12-05  Alan Modra  <amodra@bigpond.net.au>
 
        * ld-alpha/tlspic.rd: Update for unused section removal.
diff --git a/ld/testsuite/ld-elf/group3a.d b/ld/testsuite/ld-elf/group3a.d
new file mode 100644 (file)
index 0000000..83c5161
--- /dev/null
@@ -0,0 +1,8 @@
+#source: group3a.s
+#source: group3b.s
+#ld: -T group.ld
+#readelf: -s
+Symbol table '.symtab' contains .* entries:
+#...
+    .*: 0[0]*1000     0 OBJECT  GLOBAL HIDDEN    . foo
+#...
diff --git a/ld/testsuite/ld-elf/group3a.s b/ld/testsuite/ld-elf/group3a.s
new file mode 100644 (file)
index 0000000..5e6a686
--- /dev/null
@@ -0,0 +1,5 @@
+       .section .data,"awG",%progbits,foo_group,comdat
+       .globl foo
+       .type foo,%object
+foo:
+       .word 0
diff --git a/ld/testsuite/ld-elf/group3b.d b/ld/testsuite/ld-elf/group3b.d
new file mode 100644 (file)
index 0000000..82c18e4
--- /dev/null
@@ -0,0 +1,8 @@
+#source: group3b.s
+#source: group3a.s
+#ld: -T group.ld
+#readelf: -s
+Symbol table '.symtab' contains .* entries:
+#...
+    .*: 0[0]*1000     0 OBJECT  GLOBAL HIDDEN    . foo
+#...
diff --git a/ld/testsuite/ld-elf/group3b.s b/ld/testsuite/ld-elf/group3b.s
new file mode 100644 (file)
index 0000000..6c101bc
--- /dev/null
@@ -0,0 +1,6 @@
+       .section .data,"awG",%progbits,foo_group,comdat
+       .hidden foo
+       .globl foo
+       .type foo,%object
+foo:
+       .word 0