diff options
author | Alan Modra <amodra@gmail.com> | 2016-05-11 21:54:05 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-05-11 22:40:09 +0930 |
commit | 3bd43ebcb6025a8a43f119238f490e2e238697a2 (patch) | |
tree | 8f23db6516221776375d577ae78f6e3a145c69e5 /ld | |
parent | a6684f0dddb292873f962dc36b20e6db00ef6b09 (diff) | |
download | gdb-3bd43ebcb6025a8a43f119238f490e2e238697a2.zip gdb-3bd43ebcb6025a8a43f119238f490e2e238697a2.tar.gz gdb-3bd43ebcb6025a8a43f119238f490e2e238697a2.tar.bz2 |
ld --gc-sections fail with __tls_get_addr_opt
When --gc-sections is active, __tls_get_addr_opt is marked as not
needed and forced local before ppc*_elf_tls_setup is run.
bfd/
PR 20060
* elf64-ppc.c (ppc64_elf_tls_setup): Clear forced_local.
* elf32-ppc.c (ppc_elf_tls_setup): Likewise.
ld/
PR 20060
* testsuite/ld-powerpc/powerpc.exp: Run new tests.
* testsuite/ld-powerpc/tlsdll.s: New.
* testsuite/ld-powerpc/tlsdll.ver: New.
* testsuite/ld-powerpc/tlsdll_32.s: New.
* testsuite/ld-powerpc/tlsopt5.d: New.
* testsuite/ld-powerpc/tlsopt5.s: New.
* testsuite/ld-powerpc/tlsopt5_32.d: New.
* testsuite/ld-powerpc/tlsopt5_32.s: New.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/powerpc.exp | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdll.s | 19 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdll.ver | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdll_32.s | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsopt5.d | 54 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsopt5.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsopt5_32.d | 52 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsopt5_32.s | 4 |
9 files changed, 181 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 9e0e7fb..734c4b5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2016-05-11 Alan Modra <amodra@gmail.com> + + PR 20060 + * testsuite/ld-powerpc/powerpc.exp: Run new tests. + * testsuite/ld-powerpc/tlsdll.s: New. + * testsuite/ld-powerpc/tlsdll.ver: New. + * testsuite/ld-powerpc/tlsdll_32.s: New. + * testsuite/ld-powerpc/tlsopt5.d: New. + * testsuite/ld-powerpc/tlsopt5.s: New. + * testsuite/ld-powerpc/tlsopt5_32.d: New. + * testsuite/ld-powerpc/tlsopt5_32.s: New. + 2016-05-10 Thomas Preud'homme <thomas.preudhomme@arm.com> * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index ec4a4f2..46ffcf5 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -138,6 +138,11 @@ set ppcelftests { {"TLS32 opt 4" "-melf32ppc" "" "-a32" {tlsopt4_32.s tlslib32.s} {{objdump -dr tlsopt4_32.d}} "tlsopt4_32"} + {"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" "" "-a32" {tlsdll_32.s} + {} "tlsdll32.so"} + {"TLS32 opt 5" "-melf32ppc --gc-sections --secure-plt tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s} + {{objdump -dr tlsopt5_32.d}} + "tlsopt5_32"} {"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s} {} "sdalib.so"} {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "" "-a32" {sdadyn.s} @@ -203,6 +208,11 @@ set ppc64elftests { {"TLS opt 4" "-melf64ppc" "" "-a64" {tlsopt4.s tlslib.s} {{objdump -dr tlsopt4.d}} "tlsopt4"} + {"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s} + {} "tlsdll.so"} + {"TLS opt 5" "-melf64ppc --gc-sections tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s} + {{objdump -dr tlsopt5.d}} + "tlsopt5"} {"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s} {{objdump -dj.data symtocbase.d}} "symtocbase.so"} {"TOC opt" "-melf64ppc" "" "-a64" {tocopt.s} diff --git a/ld/testsuite/ld-powerpc/tlsdll.s b/ld/testsuite/ld-powerpc/tlsdll.s new file mode 100644 index 0000000..5620080 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdll.s @@ -0,0 +1,19 @@ + .abiversion 2 + .global __tls_get_addr,__tls_get_addr_opt,gd,ld + .type __tls_get_addr,@function + .type __tls_get_addr_opt,@function + + .text +__tls_get_addr: +__tls_get_addr_opt: + blr + .size __tls_get_addr,. - __tls_get_addr + .size __tls_get_addr_opt,. - __tls_get_addr_opt + + .section ".tbss","awT",@nobits + .p2align 3 +gd: .space 8 + + .section ".tdata","awT",@progbits + .p2align 2 +ld: .long 0xc0ffee diff --git a/ld/testsuite/ld-powerpc/tlsdll.ver b/ld/testsuite/ld-powerpc/tlsdll.ver new file mode 100644 index 0000000..d9439f7 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdll.ver @@ -0,0 +1,7 @@ +GLIBC_2.3 { + __tls_get_addr; +}; + +GLIBC_2.22 { + __tls_get_addr_opt; +} GLIBC_2.3; diff --git a/ld/testsuite/ld-powerpc/tlsdll_32.s b/ld/testsuite/ld-powerpc/tlsdll_32.s new file mode 100644 index 0000000..0f68c21 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdll_32.s @@ -0,0 +1,18 @@ + .global __tls_get_addr,__tls_get_addr_opt,gd,ld + .type __tls_get_addr,@function + .type __tls_get_addr_opt,@function + + .text +__tls_get_addr: +__tls_get_addr_opt: + blr + .size __tls_get_addr,. - __tls_get_addr + .size __tls_get_addr_opt,. - __tls_get_addr_opt + + .section ".tbss","awT",@nobits + .p2align 2 +gd: .space 4 + + .section ".tdata","awT",@progbits + .p2align 2 +ld: .long 0xc0ffee diff --git a/ld/testsuite/ld-powerpc/tlsopt5.d b/ld/testsuite/ld-powerpc/tlsopt5.d new file mode 100644 index 0000000..7b17130 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsopt5.d @@ -0,0 +1,54 @@ +#source: tlsopt5.s +#as: -a64 +#ld: --gc-sections tlsdll.so +#objdump: -dr +#target: powerpc64*-*-* + +.* + +Disassembly of section \.text: + +0000000010000300 <.*\.plt_call\.__tls_get_addr_opt@@GLIBC_2\.22>: +.*: (00 00 63 e9|e9 63 00 00) ld r11,0\(r3\) +.*: (08 00 83 e9|e9 83 00 08) ld r12,8\(r3\) +.*: (78 1b 60 7c|7c 60 1b 78) mr r0,r3 +.*: (00 00 2b 2c|2c 2b 00 00) cmpdi r11,0 +.*: (14 6a 6c 7c|7c 6c 6a 14) add r3,r12,r13 +.*: (20 00 82 4d|4d 82 00 20) beqlr +.*: (78 03 03 7c|7c 03 03 78) mr r3,r0 +.*: (a6 02 68 7d|7d 68 02 a6) mflr r11 +.*: (08 00 61 f9|f9 61 00 08) std r11,8\(r1\) +.*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) +.*: (28 80 82 e9|e9 82 80 28) ld r12,-32728\(r2\) +.*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 +.*: (21 04 80 4e|4e 80 04 21) bctrl +.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\) +.*: (08 00 61 e9|e9 61 00 08) ld r11,8\(r1\) +.*: (a6 03 68 7d|7d 68 03 a6) mtlr r11 +.*: (20 00 80 4e|4e 80 00 20) blr + +0000000010000344 <_start>: +.*: (08 80 62 38|38 62 80 08) addi r3,r2,-32760 +.*: (b9 ff ff 4b|4b ff ff b9) bl .* +.*: (00 00 00 60|60 00 00 00) nop +.*: (b8 02 01 00|00 00 00 00) .* +.*: (00 00 00 00|00 01 02 b8) .* + +0000000010000358 <__glink_PLTresolve>: +.*: (a6 02 08 7c|7c 08 02 a6) mflr r0 +.*: (05 00 9f 42|42 9f 00 05) bcl .* +.*: (a6 02 68 7d|7d 68 02 a6) mflr r11 +.*: (f0 ff 4b e8|e8 4b ff f0) ld r2,-16\(r11\) +.*: (a6 03 08 7c|7c 08 03 a6) mtlr r0 +.*: (50 60 8b 7d|7d 8b 60 50) subf r12,r11,r12 +.*: (14 5a 62 7d|7d 62 5a 14) add r11,r2,r11 +.*: (d0 ff 0c 38|38 0c ff d0) addi r0,r12,-48 +.*: (00 00 8b e9|e9 8b 00 00) ld r12,0\(r11\) +.*: (82 f0 00 78|78 00 f0 82) rldicl r0,r0,62,2 +.*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 +.*: (08 00 6b e9|e9 6b 00 08) ld r11,8\(r11\) +.*: (20 04 80 4e|4e 80 04 20) bctr +.*: (00 00 00 60|60 00 00 00) nop + +0000000010000390 <__tls_get_addr_opt@plt>: +.*: (c8 ff ff 4b|4b ff ff c8) b .* diff --git a/ld/testsuite/ld-powerpc/tlsopt5.s b/ld/testsuite/ld-powerpc/tlsopt5.s new file mode 100644 index 0000000..598bbd9 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsopt5.s @@ -0,0 +1,5 @@ + .globl _start +_start: + addi 3,2,gd@got@tlsgd + bl __tls_get_addr(gd@tlsgd) + nop diff --git a/ld/testsuite/ld-powerpc/tlsopt5_32.d b/ld/testsuite/ld-powerpc/tlsopt5_32.d new file mode 100644 index 0000000..9749248 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsopt5_32.d @@ -0,0 +1,52 @@ +#source: tlsopt5_32.s +#as: -a32 +#ld: --gc-sections --secure-plt tlsdll32.so +#objdump: -dr +#target: powerpc*-*-* + +.* + +Disassembly of section \.text: + +01800230 <_start>: +.*: (f8 ff 6d 38|38 6d ff f8) addi r3,r13,-8 +.*: (0d 00 00 48|48 00 00 0d) bl 1800240 <__tls_get_addr_opt@plt> + \.\.\. + +01800240 <__tls_get_addr_opt@plt>: +.*: (00 00 63 81|81 63 00 00) lwz r11,0\(r3\) +.*: (04 00 83 81|81 83 00 04) lwz r12,4\(r3\) +.*: (78 1b 60 7c|7c 60 1b 78) mr r0,r3 +.*: (00 00 0b 2c|2c 0b 00 00) cmpwi r11,0 +.*: (14 12 6c 7c|7c 6c 12 14) add r3,r12,r2 +.*: (20 00 82 4d|4d 82 00 20) beqlr +.*: (78 03 03 7c|7c 03 03 78) mr r3,r0 +.*: (00 00 00 60|60 00 00 00) nop +.*: (81 01 60 3d|3d 60 01 81) lis r11,385 +.*: (9c 03 6b 81|81 6b 03 9c) lwz r11,924\(r11\) +.*: (a6 03 69 7d|7d 69 03 a6) mtctr r11 +.*: (20 04 80 4e|4e 80 04 20) bctr + +01800270 <__glink>: +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop + +01800280 <__glink_PLTresolve>: +.*: (81 01 80 3d|3d 80 01 81) lis r12,385 +.*: (80 fe 6b 3d|3d 6b fe 80) addis r11,r11,-384 +.*: (94 03 0c 80|80 0c 03 94) lwz r0,916\(r12\) +.*: (90 fd 6b 39|39 6b fd 90) addi r11,r11,-624 +.*: (a6 03 09 7c|7c 09 03 a6) mtctr r0 +.*: (14 5a 0b 7c|7c 0b 5a 14) add r0,r11,r11 +.*: (98 03 8c 81|81 8c 03 98) lwz r12,920\(r12\) +.*: (14 5a 60 7d|7d 60 5a 14) add r11,r0,r11 +.*: (20 04 80 4e|4e 80 04 20) bctr +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop +.*: (00 00 00 60|60 00 00 00) nop diff --git a/ld/testsuite/ld-powerpc/tlsopt5_32.s b/ld/testsuite/ld-powerpc/tlsopt5_32.s new file mode 100644 index 0000000..36b4858 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsopt5_32.s @@ -0,0 +1,4 @@ + .globl _start +_start: + addi 3,13,gd@got@tlsgd + bl __tls_get_addr(gd@tlsgd) |