This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/10434: -fpie + -pie does not appear to work with __thread variables
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 23 Jul 2009 14:20:05 -0700
- Subject: PATCH: PR ld/10434: -fpie + -pie does not appear to work with __thread variables
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
I am checking in this patch to fix R_X86_64_TPOFF32 for PIE.
H.J.
---
bfd/
2009-07-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10434
* elf64-x86-64.c (elf64_x86_64_check_relocs): Check executable
instead of shared for R_X86_64_TPOFF32.
(elf64_x86_64_relocate_section): Likewise.
ld/testsuite/
2009-07-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10434
* ld-x86-64/tlsle1.d: New.
* ld-x86-64/tlsle1.s: Likewise.
* ld-x86-64/x86-64.exp: Run tlsle1.
Index: ld/testsuite/ld-x86-64/tlsle1.d
===================================================================
--- ld/testsuite/ld-x86-64/tlsle1.d (revision 0)
+++ ld/testsuite/ld-x86-64/tlsle1.d (revision 0)
@@ -0,0 +1,6 @@
+#name: TLS LE with PIE
+#as: --64
+#ld: -melf_x86_64 -pie
+#readelf: -r
+
+There are no relocations in this file.
Index: ld/testsuite/ld-x86-64/tlsle1.s
===================================================================
--- ld/testsuite/ld-x86-64/tlsle1.s (revision 0)
+++ ld/testsuite/ld-x86-64/tlsle1.s (revision 0)
@@ -0,0 +1,11 @@
+ .text
+ .globl _start
+_start:
+ movl $0, %fs:foo@TPOFF
+ .globl foo
+ .section .tdata,"awT",@progbits
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 100
Index: ld/testsuite/ld-x86-64/x86-64.exp
===================================================================
--- ld/testsuite/ld-x86-64/x86-64.exp (revision 6446)
+++ ld/testsuite/ld-x86-64/x86-64.exp (working copy)
@@ -92,4 +92,4 @@ run_dump_test "hidden3"
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
-
+run_dump_test "tlsle1"
Index: bfd/elf64-x86-64.c
===================================================================
--- bfd/elf64-x86-64.c (revision 6446)
+++ bfd/elf64-x86-64.c (working copy)
@@ -1231,7 +1231,7 @@ elf64_x86_64_check_relocs (bfd *abfd, st
goto create_got;
case R_X86_64_TPOFF32:
- if (info->shared)
+ if (!info->executable)
{
if (h)
name = h->root.root.string;
@@ -3639,7 +3639,7 @@ elf64_x86_64_relocate_section (bfd *outp
break;
case R_X86_64_TPOFF32:
- BFD_ASSERT (! info->shared);
+ BFD_ASSERT (info->executable);
relocation = elf64_x86_64_tpoff (info, relocation);
break;