Don't bind unique symbol locally.
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 7 Apr 2010 02:41:35 +0000 (02:41 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 7 Apr 2010 02:41:35 +0000 (02:41 +0000)
bfd/

2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/11434
* elf-bfd.h (SYMBOLIC_BIND): Don't bind unique symbol locally.

ld/testsuite/

2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/11434
* ld/testsuite/ld-x86-64/unique1.d: New.
* ld/testsuite/ld-x86-64/unique1.s: Likewise.

* ld-x86-64/x86-64.exp: Run unique1.

bfd/ChangeLog
bfd/elf-bfd.h
ld/ChangeLog
ld/testsuite/ld-x86-64/unique1.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/unique1.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index 6d425d1388a0f72185478c34611c6b402c5204d1..1d4fecb8faffee8f4c1131f541dbfd242f2c45fc 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/11434
+       * elf-bfd.h (SYMBOLIC_BIND): Don't bind unique symbol locally.
+
 2010-04-06  Tristan Gingold  <gingold@adacore.com>
 
        * vms-lib.c (_bfd_vms_lib_write_archive_contents): Fix idd flags.
index 74348d3abb64bfbc3476baa16e398f7f1f481847..05e17c8f5b0206b6f5c9dcd680625d6a9ac81897 100644 (file)
@@ -2328,8 +2328,9 @@ extern asection _bfd_elf_large_com_section;
   while (0)
 
 /* Will a symbol be bound to the the definition within the shared
-   library, if any.  */
+   library, if any.  A unique symbol can never be bound locally.  */
 #define SYMBOLIC_BIND(INFO, H) \
-    ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))
+    (!(H)->unique_global \
+     && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
 
 #endif /* _LIBELF_H_ */
index 1d8c9f61ec368b3c5f7e2064f7bcee2470a23728..3c3ef033f72990c9dd3c1d060dfe386e9f7d37cf 100644 (file)
@@ -1,3 +1,11 @@
+2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/11434
+       * ld/testsuite/ld-x86-64/unique1.d: New.
+       * ld/testsuite/ld-x86-64/unique1.s: Likewise.
+
+       * ld-x86-64/x86-64.exp: Run unique1.
+
 2010-04-05  Kai Tietz  <kai.tietz@onevision.com>
 
        * emultempl/pep.em (U): Macro modified.
diff --git a/ld/testsuite/ld-x86-64/unique1.d b/ld/testsuite/ld-x86-64/unique1.d
new file mode 100644 (file)
index 0000000..00afd38
--- /dev/null
@@ -0,0 +1,10 @@
+#name: STB_GNU_UNIQUE with -Bsymbolic
+#as: --64
+#ld: -melf_x86_64 -shared -Bsymbolic
+#readelf: -rs --wide
+
+#...
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +[0-9a-f]+ bar \+ 0
+#...
+ +[0-9]+: +[0-9a-f]+ +8 +OBJECT +UNIQUE +DEFAULT +[0-9]+ bar
+#pass
diff --git a/ld/testsuite/ld-x86-64/unique1.s b/ld/testsuite/ld-x86-64/unique1.s
new file mode 100644 (file)
index 0000000..3def1b3
--- /dev/null
@@ -0,0 +1,9 @@
+       .text
+foo:
+       movq    bar@GOTPCREL(%rip), %rbp
+       .weak   bar
+       .data
+       .type   bar, @gnu_unique_object
+       .size   bar, 8
+bar:
+       .quad 8
index 89a2e1468003a77386f5c1b146c92c141f5e8566..a8ebd4119f64c2d90e61e1a6780b783508f7a48b 100644 (file)
@@ -97,3 +97,4 @@ run_dump_test "protected3"
 run_dump_test "protected3-l1om"
 run_dump_test "tlsle1"
 run_dump_test "tlspie1"
+run_dump_test "unique1"