diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2011-05-26 13:22:04 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2011-05-26 13:22:04 +0000 |
commit | 6769d5017ff78562047c02b1efbe8743c9368800 (patch) | |
tree | d86b4112e87b5a72c43da6cf3dd665fd4738b93a /ld | |
parent | 59d70315fb5373d4c924b118c4f2d0d7e0e99e7d (diff) | |
download | gdb-6769d5017ff78562047c02b1efbe8743c9368800.zip gdb-6769d5017ff78562047c02b1efbe8743c9368800.tar.gz gdb-6769d5017ff78562047c02b1efbe8743c9368800.tar.bz2 |
Handle R_X86_64_TPOFF64 in executable.
bfd/
2011-05-26 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12809
* elf64-x86-64.c (elf_x86_64_relocate_section): Handle
R_X86_64_TPOFF64 in executable.
ld/testsuite/
2011-05-26 H.J. Lu <hongjiu.lu@intel.com>
PR ld/12809
* ld-x86-64/tlsbin.s: Add a test for LE with large model.
* ld-x86-64/tlsbin.dd: Updated.
* ld-x86-64/tlsbin.rd: Likewise.
* ld-x86-64/tlsbin.sd: Likewise.
* ld-x86-64/tlsbin.td: Likewise.
* ld-x86-64/tlsbindesc.dd: Likewise.
* ld-x86-64/tlsbindesc.rd: Likewise.
* ld-x86-64/tlsbindesc.sd: Likewise.
* ld-x86-64/tlsbindesc.td: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbin.dd | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbin.rd | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbin.s | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbin.sd | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbin.td | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbindesc.dd | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbindesc.rd | 32 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbindesc.sd | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tlsbindesc.td | 12 |
10 files changed, 77 insertions, 54 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 7975caf..d3bafcc 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2011-05-26 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/12809 + * ld-x86-64/tlsbin.s: Add a test for LE with large model. + + * ld-x86-64/tlsbin.dd: Updated. + * ld-x86-64/tlsbin.rd: Likewise. + * ld-x86-64/tlsbin.sd: Likewise. + * ld-x86-64/tlsbin.td: Likewise. + * ld-x86-64/tlsbindesc.dd: Likewise. + * ld-x86-64/tlsbindesc.rd: Likewise. + * ld-x86-64/tlsbindesc.sd: Likewise. + * ld-x86-64/tlsbindesc.td: Likewise. + 2011-05-24 Hans-Peter Nilsson <hp@axis.com> * ld-cris/tls-e-tpoffcomm1.d: Adjust for second PR12763 change, diff --git a/ld/testsuite/ld-x86-64/tlsbin.dd b/ld/testsuite/ld-x86-64/tlsbin.dd index 6d0de98..b87f34a 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.dd +++ b/ld/testsuite/ld-x86-64/tlsbin.dd @@ -24,7 +24,7 @@ Disassembly of section .text: # GD -> IE because variable is not defined in executable 401004: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax 40100b: 00 00 * - 40100d: 48 03 05 d4 03 20 00[ ]+add 0x2003d4\(%rip\),%rax +# 6013e8 <.*> + 40100d: 48 03 05 dc 03 20 00[ ]+add 0x2003dc\(%rip\),%rax +# 6013f0 <.*> # -> R_X86_64_TPOFF64 sG1 401014: 90[ ]+nop * 401015: 90[ ]+nop * @@ -34,7 +34,7 @@ Disassembly of section .text: # the variable is referenced through IE too 401018: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax 40101f: 00 00 * - 401021: 48 03 05 b0 03 20 00[ ]+add 0x2003b0\(%rip\),%rax +# 6013d8 <.*> + 401021: 48 03 05 b8 03 20 00[ ]+add 0x2003b8\(%rip\),%rax +# 6013e0 <.*> # -> R_X86_64_TPOFF64 sG2 401028: 90[ ]+nop * 401029: 90[ ]+nop * @@ -102,7 +102,7 @@ Disassembly of section .text: 4010b3: 00 00 * 4010b5: 90[ ]+nop * 4010b6: 90[ ]+nop * - 4010b7: 4c 03 0d 1a 03 20 00[ ]+add 0x20031a\(%rip\),%r9 +# 6013d8 <.*> + 4010b7: 4c 03 0d 22 03 20 00[ ]+add 0x200322\(%rip\),%r9 +# 6013e0 <.*> # -> R_X86_64_TPOFF64 sG2 4010be: 90[ ]+nop * 4010bf: 90[ ]+nop * @@ -143,7 +143,7 @@ Disassembly of section .text: 401103: 90[ ]+nop * # Direct access through %fs # IE against global var - 401104: 48 8b 0d c5 02 20 00[ ]+mov 0x2002c5\(%rip\),%rcx +# 6013d0 <.*> + 401104: 48 8b 0d cd 02 20 00[ ]+mov 0x2002cd\(%rip\),%rcx +# 6013d8 <.*> # -> R_X86_64_TPOFF64 sG5 40110b: 90[ ]+nop * 40110c: 90[ ]+nop * @@ -186,7 +186,7 @@ Disassembly of section .text: 401147: 00 00 * 401149: 90[ ]+nop * 40114a: 90[ ]+nop * - 40114b: 4c 03 1d 8e 02 20 00[ ]+add 0x20028e\(%rip\),%r11 +# 6013e0 <.*> + 40114b: 4c 03 1d 96 02 20 00[ ]+add 0x200296\(%rip\),%r11 +# 6013e8 <.*> # -> R_X86_64_TPOFF64 sG6 401152: 90[ ]+nop * 401153: 90[ ]+nop * @@ -306,5 +306,8 @@ Disassembly of section .text: 401225: 90[ ]+nop * 401226: 90[ ]+nop * 401227: 90[ ]+nop * - 401228: c9[ ]+leaveq * - 401229: c3[ ]+retq * +# LE, large model + 401228: 48 ba a5 ff ff ff ff[ ]+movabs \$0xffffffffffffffa5,%rdx + 40122f: ff ff ff * + 401232: c9[ ]+leaveq * + 401233: c3[ ]+retq * diff --git a/ld/testsuite/ld-x86-64/tlsbin.rd b/ld/testsuite/ld-x86-64/tlsbin.rd index 03e5efc..936f370 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.rd +++ b/ld/testsuite/ld-x86-64/tlsbin.rd @@ -17,12 +17,12 @@ Section Headers: +\[[ 0-9]+\] .rela.dyn +.* +\[[ 0-9]+\] .rela.plt +.* +\[[ 0-9]+\] .plt +.* - +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+22a 00 +AX +0 +0 +4096 - +\[[ 0-9]+\] .tdata +PROGBITS +0+60122a 0+122a 0+60 00 WAT +0 +0 +1 - +\[[ 0-9]+\] .tbss +NOBITS +0+60128a 0+128a 0+40 00 WAT +0 +0 +1 - +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601290 0+1290 0+140 10 +WA +4 +0 +8 - +\[[ 0-9]+\] .got +PROGBITS +0+6013d0 0+13d0 0+20 08 +WA +0 +0 +8 - +\[[ 0-9]+\] .got.plt +PROGBITS +0+6013f0 0+13f0 0+20 08 +WA +0 +0 +8 + +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+234 00 +AX +0 +0 +4096 + +\[[ 0-9]+\] .tdata +PROGBITS +0+601234 0+1234 0+60 00 WAT +0 +0 +1 + +\[[ 0-9]+\] .tbss +NOBITS +0+601294 0+1294 0+40 00 WAT +0 +0 +1 + +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601298 0+1298 0+140 10 +WA +4 +0 +8 + +\[[ 0-9]+\] .got +PROGBITS +0+6013d8 0+13d8 0+20 08 +WA +0 +0 +8 + +\[[ 0-9]+\] .got.plt +PROGBITS +0+6013f8 0+13f8 0+20 08 +WA +0 +0 +8 +\[[ 0-9]+\] .shstrtab +.* +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* @@ -40,10 +40,10 @@ Program Headers: +PHDR.* +INTERP.* .*Requesting program interpreter.* - +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+122a 0x0+122a R E 0x200000 - +LOAD +0x0+122a 0x0+60122a 0x0+60122a 0x0+1e6 0x0+1e6 RW +0x200000 - +DYNAMIC +0x0+1290 0x0+601290 0x0+601290 0x0+140 0x0+140 RW +0x8 - +TLS +0x0+122a 0x0+60122a 0x0+60122a 0x0+60 0x0+a0 R +0x1 + +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+1234 0x0+1234 R E 0x200000 + +LOAD +0x0+1234 0x0+601234 0x0+601234 0x0+1e4 0x0+1e4 RW +0x200000 + +DYNAMIC +0x0+1298 0x0+601298 0x0+601298 0x0+140 0x0+140 RW +0x8 + +TLS +0x0+1234 0x0+601234 0x0+601234 0x0+60 0x0+a0 R +0x1 Section to Segment mapping: +Segment Sections... diff --git a/ld/testsuite/ld-x86-64/tlsbin.s b/ld/testsuite/ld-x86-64/tlsbin.s index eb9bfbc..1184740 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.s +++ b/ld/testsuite/ld-x86-64/tlsbin.s @@ -93,5 +93,8 @@ _start: movq %fs:1+sh3@tpoff, %rdx nop;nop;nop;nop + /* LE, large model */ + movabsq $sh2@tpoff+1, %rdx + leave ret diff --git a/ld/testsuite/ld-x86-64/tlsbin.sd b/ld/testsuite/ld-x86-64/tlsbin.sd index 7fbc565..050e595 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.sd +++ b/ld/testsuite/ld-x86-64/tlsbin.sd @@ -8,5 +8,5 @@ .*: +file format elf64-x86-64 Contents of section .got: - 6013d0 00000000 00000000 00000000 00000000 .* - 6013e0 00000000 00000000 00000000 00000000 .* + 6013d8 00000000 00000000 00000000 00000000 .* + 6013e8 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-x86-64/tlsbin.td b/ld/testsuite/ld-x86-64/tlsbin.td index b3851de..76736db 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.td +++ b/ld/testsuite/ld-x86-64/tlsbin.td @@ -8,9 +8,9 @@ .*: +file format elf64-x86-64 Contents of section .tdata: - 60122a 11000000 12000000 13000000 14000000 .* - 60123a 15000000 16000000 17000000 18000000 .* - 60124a 41000000 42000000 43000000 44000000 .* - 60125a 45000000 46000000 47000000 48000000 .* - 60126a 01010000 02010000 03010000 04010000 .* - 60127a 05010000 06010000 07010000 08010000 .* + 601234 11000000 12000000 13000000 14000000 .* + 601244 15000000 16000000 17000000 18000000 .* + 601254 41000000 42000000 43000000 44000000 .* + 601264 45000000 46000000 47000000 48000000 .* + 601274 01010000 02010000 03010000 04010000 .* + 601284 05010000 06010000 07010000 08010000 .* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.dd b/ld/testsuite/ld-x86-64/tlsbindesc.dd index 9e82eab..5157c81 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.dd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.dd @@ -22,7 +22,7 @@ Disassembly of section .text: [0-9a-f]+: 55[ ]+push %rbp [0-9a-f]+: 48 89 e5[ ]+mov %rsp,%rbp # GD -> IE because variable is not defined in executable - [0-9a-f]+: 48 8b 05 65 03 20 00[ ]+mov 0x200365\(%rip\),%rax +# 601370 <.*> + [0-9a-f]+: 48 8b 05 6d 03 20 00[ ]+mov 0x20036d\(%rip\),%rax +# 601378 <.*> # -> R_X86_64_TPOFF64 sG1 [0-9a-f]+: 66 90[ ]+xchg %ax,%ax [0-9a-f]+: 90[ ]+nop * @@ -31,7 +31,7 @@ Disassembly of section .text: [0-9a-f]+: 90[ ]+nop * # GD -> IE because variable is not defined in executable where # the variable is referenced through IE too - [0-9a-f]+: 48 8b 05 48 03 20 00[ ]+mov 0x200348\(%rip\),%rax +# 601360 <.*> + [0-9a-f]+: 48 8b 05 50 03 20 00[ ]+mov 0x200350\(%rip\),%rax +# 601368 <.*> # -> R_X86_64_TPOFF64 sG2 [0-9a-f]+: 66 90[ ]+xchg %ax,%ax [0-9a-f]+: 90[ ]+nop * @@ -93,7 +93,7 @@ Disassembly of section .text: [0-9a-f]+: 00 00 * [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * - [0-9a-f]+: 4c 03 0d d6 02 20 00[ ]+add 0x2002d6\(%rip\),%r9 +# 601360 <.*> + [0-9a-f]+: 4c 03 0d de 02 20 00[ ]+add 0x2002de\(%rip\),%r9 +# 601368 <.*> # -> R_X86_64_TPOFF64 sG2 [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * @@ -134,7 +134,7 @@ Disassembly of section .text: [0-9a-f]+: 90[ ]+nop * # Direct access through %fs # IE against global var - [0-9a-f]+: 48 8b 0d 81 02 20 00[ ]+mov 0x200281\(%rip\),%rcx +# 601358 <.*> + [0-9a-f]+: 48 8b 0d 89 02 20 00[ ]+mov 0x200289\(%rip\),%rcx +# 601360 <.*> # -> R_X86_64_TPOFF64 sG5 [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * @@ -177,7 +177,7 @@ Disassembly of section .text: [0-9a-f]+: 00 00 * [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * - [0-9a-f]+: 4c 03 1d 4a 02 20 00[ ]+add 0x20024a\(%rip\),%r11 +# 601368 <.*> + [0-9a-f]+: 4c 03 1d 52 02 20 00[ ]+add 0x200252\(%rip\),%r11 +# 601370 <.*> # -> R_X86_64_TPOFF64 sG6 [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * @@ -297,5 +297,8 @@ Disassembly of section .text: [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * [0-9a-f]+: 90[ ]+nop * +# LE, large model + [0-9a-f]+: 48 ba a5 ff ff ff ff[ ]+movabs \$0xffffffffffffffa5,%rdx + [0-9a-f]+: ff ff ff * [0-9a-f]+: c9[ ]+leaveq * [0-9a-f]+: c3[ ]+retq * diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.rd b/ld/testsuite/ld-x86-64/tlsbindesc.rd index 7e94022..5f25090 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.rd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.rd @@ -15,12 +15,12 @@ Section Headers: +\[[ 0-9]+\] .dynsym +.* +\[[ 0-9]+\] .dynstr +.* +\[[ 0-9]+\] .rela.dyn +.* - +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+1f6 00 +AX +0 +0 +4096 - +\[[ 0-9]+\] .tdata +PROGBITS +0+6011f6 0+11f6 0+60 00 WAT +0 +0 +1 - +\[[ 0-9]+\] .tbss +NOBITS +0+601256 0+1256 0+40 00 WAT +0 +0 +1 - +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601258 0+1258 0+100 10 +WA +4 +0 +8 - +\[[ 0-9]+\] .got +PROGBITS +0+601358 0+1358 0+20 08 +WA +0 +0 +8 - +\[[ 0-9]+\] .got.plt +PROGBITS +0+601378 0+1378 0+18 08 +WA +0 +0 +8 + +\[[ 0-9]+\] .text +PROGBITS +0+401000 0+1000 0+200 00 +AX +0 +0 +4096 + +\[[ 0-9]+\] .tdata +PROGBITS +0+601200 0+1200 0+60 00 WAT +0 +0 +1 + +\[[ 0-9]+\] .tbss +NOBITS +0+601260 0+1260 0+40 00 WAT +0 +0 +1 + +\[[ 0-9]+\] .dynamic +DYNAMIC +0+601260 0+1260 0+100 10 +WA +4 +0 +8 + +\[[ 0-9]+\] .got +PROGBITS +0+601360 0+1360 0+20 08 +WA +0 +0 +8 + +\[[ 0-9]+\] .got.plt +PROGBITS +0+601380 0+1380 0+18 08 +WA +0 +0 +8 +\[[ 0-9]+\] .shstrtab +.* +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* @@ -38,10 +38,10 @@ Program Headers: +PHDR.* +INTERP.* .*Requesting program interpreter.* - +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+11f6 0x0+11f6 R E 0x200000 - +LOAD +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+19a 0x0+19a RW +0x200000 - +DYNAMIC +0x0+1258 0x0+601258 0x0+601258 0x0+100 0x0+100 RW +0x8 - +TLS +0x0+11f6 0x0+6011f6 0x0+6011f6 0x0+60 0x0+a0 R +0x1 + +LOAD +0x0+ 0x0+400000 0x0+400000 0x0+1200 0x0+1200 R E 0x200000 + +LOAD +0x0+1200 0x0+601200 0x0+601200 0x0+198 0x0+198 RW +0x200000 + +DYNAMIC +0x0+1260 0x0+601260 0x0+601260 0x0+100 0x0+100 RW +0x8 + +TLS +0x0+1200 0x0+601200 0x0+601200 0x0+60 0x0+a0 R +0x1 Section to Segment mapping: +Segment Sections... @@ -54,10 +54,10 @@ Program Headers: Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries: +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend -0+601358 +0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0 -0+601360 +0+200000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0 -0+601368 +0+400000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0 -0+601370 +0+500000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0 +0+601360 +0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0 +0+601368 +0+200000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0 +0+601370 +0+400000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0 +0+601378 +0+500000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0 Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name @@ -101,8 +101,8 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: 0+98 +0 +TLS +LOCAL +DEFAULT +8 bl7 +[0-9]+: 0+9c +0 +TLS +LOCAL +DEFAULT +8 bl8 +[0-9]+: 0+a0 +0 +TLS +LOCAL +DEFAULT +7 _TLS_MODULE_BASE_ - +[0-9]+: 0+601258 +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC - +[0-9]+: 0+601378 +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_ + +[0-9]+: 0+601260 +0 +OBJECT +LOCAL +DEFAULT +9 _DYNAMIC + +[0-9]+: 0+601380 +0 +OBJECT +LOCAL +DEFAULT +11 _GLOBAL_OFFSET_TABLE_ +[0-9]+: 0+1c +0 +TLS +GLOBAL +DEFAULT +7 sg8 +[0-9]+: 0+7c +0 +TLS +GLOBAL +DEFAULT +8 bg8 +[0-9]+: 0+74 +0 +TLS +GLOBAL +DEFAULT +8 bg6 diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.sd b/ld/testsuite/ld-x86-64/tlsbindesc.sd index f622bc4..37fa544 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.sd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.sd @@ -8,5 +8,5 @@ .*: +file format elf64-x86-64 Contents of section .got: - 601358 00000000 00000000 00000000 00000000 .* - 601368 00000000 00000000 00000000 00000000 .* + 601360 00000000 00000000 00000000 00000000 .* + 601370 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.td b/ld/testsuite/ld-x86-64/tlsbindesc.td index b2a3ebe..7f2d572 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.td +++ b/ld/testsuite/ld-x86-64/tlsbindesc.td @@ -8,9 +8,9 @@ .*: +file format elf64-x86-64 Contents of section .tdata: - 6011f6 11000000 12000000 13000000 14000000 .* - 601206 15000000 16000000 17000000 18000000 .* - 601216 41000000 42000000 43000000 44000000 .* - 601226 45000000 46000000 47000000 48000000 .* - 601236 01010000 02010000 03010000 04010000 .* - 601246 05010000 06010000 07010000 08010000 .* + 601200 11000000 12000000 13000000 14000000 .* + 601210 15000000 16000000 17000000 18000000 .* + 601220 41000000 42000000 43000000 44000000 .* + 601230 45000000 46000000 47000000 48000000 .* + 601240 01010000 02010000 03010000 04010000 .* + 601250 05010000 06010000 07010000 08010000 .* |