Properly handle R_386_TLS_LDO_32 for PIE.

bfd/

2011-04-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12654
	* elf32-i386.c (elf_i386_relocate_section): Check !executable
	instead of shared for R_386_TLS_LDO_32.

ld/testsuite/

2011-04-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12654
	* ld-i386/i386.exp: Run tlspie2.

	* ld-i386/tlspie2.d: New.
	* ld-i386/tlspie2.s: Likewise.
This commit is contained in:
H.J. Lu 2011-04-08 16:14:49 +00:00
parent 0e9dfb4626
commit 959b0961c9
6 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-04-08 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12654
* elf32-i386.c (elf_i386_relocate_section): Check !executable
instead of shared for R_386_TLS_LDO_32.
2011-04-08 Tristan Gingold <gingold@adacore.com>
* Makefile.am (SOURCE_HFILES): Remove xcoff-target.h

View File

@ -4025,7 +4025,7 @@ elf_i386_relocate_section (bfd *output_bfd,
break;
case R_386_TLS_LDO_32:
if (info->shared || (input_section->flags & SEC_CODE) == 0)
if (!info->executable || (input_section->flags & SEC_CODE) == 0)
relocation -= elf_i386_dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */

View File

@ -1,3 +1,11 @@
2011-04-08 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12654
* ld-i386/i386.exp: Run tlspie2.
* ld-i386/tlspie2.d: New.
* ld-i386/tlspie2.s: Likewise.
2011-04-06 Joseph Myers <joseph@codesourcery.com>
* ld-selective/selective.exp (xscale-*-*): Don't handle.

View File

@ -190,6 +190,7 @@ run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
run_dump_test "tlspie1"
run_dump_test "tlspie2"
run_dump_test "nogot1"
run_dump_test "nogot2"
run_dump_test "discarded1"

View File

@ -0,0 +1,13 @@
#name: TLS with PIE
#as: --32
#ld: -melf_i386 -pie
#objdump: -dw
.*: +file format .*
Disassembly of section .text:
0+188 <_start>:
[ ]*[a-f0-9]+: 8d 05 fc ff ff ff lea 0xfffffffc,%eax
#pass

View File

@ -0,0 +1,12 @@
.section .tbss,"awT",@nobits
.align 4
.type a, @object
.size a, 4
a:
.zero 4
.text
.globl _start
.type _start, @function
_start:
leal a@dtpoff, %eax
.size _start, .-_start