This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR ld/11434: ld resolves relocations against STB_GNU_UNIQUE in DT_SYMBOLIC libraries


Hi,

We shouldn't bind STB_GNU_UNIQUE symbol locally with -Bsymbolic. OK
to install?

Thanks.


H.J.
---
bfd/

2010-03-26  H.J. Lu  <hongjiu.lu@intel.com>

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

ld/testsuite/

2010-03-26  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.

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 74348d3..05e17c8 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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_ */
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 89a2e14..a8ebd41 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -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"
--- /dev/null	2010-03-24 14:33:54.586784588 -0700
+++ binutils/ld/testsuite/ld-x86-64/unique1.d	2010-03-26 07:55:36.000000000 -0700
@@ -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
--- /dev/null	2010-03-24 14:33:54.586784588 -0700
+++ binutils/ld/testsuite/ld-x86-64/unique1.s	2010-03-26 07:50:27.000000000 -0700
@@ -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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]