diff options
author | Alan Modra <amodra@gmail.com> | 2020-01-22 12:24:56 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-01-22 17:14:08 +1030 |
commit | a804e4760a9f05aeb61071f8caad3579e6a197a2 (patch) | |
tree | c25f0e5d42c379e7d388df47f6f0fe698a0bdd3b /ld | |
parent | 9e7028aa1e788d666bad91fb20159da6c95bbab1 (diff) | |
download | gdb-a804e4760a9f05aeb61071f8caad3579e6a197a2.zip gdb-a804e4760a9f05aeb61071f8caad3579e6a197a2.tar.gz gdb-a804e4760a9f05aeb61071f8caad3579e6a197a2.tar.bz2 |
PowerPC64 tls_get_addr_desc static support
This provides a linker generated __tls_get_addr_desc wrapper function
preserving registers around a __tls_get_addr call. The idea being to
support __tls_get_addr_desc without requiring a glibc update.
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
(ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
__tls_get_addr_desc.
(ppc64_elf_size_stubs): Add section for linker generated
__tls_get_addr_desc wrapper function. Loop at least once if
generating this function.
(emit_tga_desc, emit_tga_desc_eh_frame): New functions.
(ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
ld/
* testsuite/ld-powerpc/tlsdesc3.d,
* testsuite/ld-powerpc/tlsdesc3.wf,
* testsuite/ld-powerpc/tlsdesc4.d,
* testsuite/ld-powerpc/tlsdesc4.s,
* testsuite/ld-powerpc/tlsdesc4.wf: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/powerpc.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdesc3.d | 38 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdesc3.wf | 43 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdesc4.d | 46 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdesc4.s | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsdesc4.wf | 49 |
7 files changed, 209 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index edfc090..b196d21 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,14 @@ 2020-01-22 Alan Modra <amodra@gmail.com> + * testsuite/ld-powerpc/tlsdesc3.d, + * testsuite/ld-powerpc/tlsdesc3.wf, + * testsuite/ld-powerpc/tlsdesc4.d, + * testsuite/ld-powerpc/tlsdesc4.s, + * testsuite/ld-powerpc/tlsdesc4.wf: New tests. + * testsuite/ld-powerpc/powerpc.exp: Run them. + +2020-01-22 Alan Modra <amodra@gmail.com> + * emultempl/ppc64elf.em (ppc64_opt, PARSE_AND_LIST_LONGOPTS), (PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Support --tls-get-addr-regsave and --no-tls-get-addr-regsave. diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index d50846c..94b2fac 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -280,6 +280,12 @@ set ppc64elftests { {"TLSdesc2" "-melf64ppc -shared --hash-style=both --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsdesc.s} {{objdump -dr tlsdesc2.d} {readelf -wf tlsdesc2.wf}} "tlsdesc2"} + {"TLSdesc3" "-melf64ppc --no-tls-optimize tmpdir/tlsdll.o" "" "-a64" {tlsdesc.s} + {{objdump -dr tlsdesc3.d} {readelf -wf tlsdesc3.wf}} + "tlsdesc3"} + {"TLSdesc4" "-melf64ppc --no-tls-optimize tmpdir/tlsdll.o" "" "-a64" {tlsdesc4.s} + {{objdump -dr tlsdesc4.d} {readelf -wf tlsdesc4.wf}} + "tlsdesc4"} {"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/tlsdesc3.d b/ld/testsuite/ld-powerpc/tlsdesc3.d new file mode 100644 index 0000000..360dcff --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdesc3.d @@ -0,0 +1,38 @@ + +.*: file format .* + +Disassembly of section \.text: + +0+10000100 <__tls_get_addr_desc>: +.*: (7c 08 02 a6|a6 02 08 7c) mflr r0 +.*: (f8 01 00 10|10 00 01 f8) std r0,16\(r1\) +.*: (f8 81 ff c0|c0 ff 81 f8) std r4,-64\(r1\) +.*: (f8 a1 ff c8|c8 ff a1 f8) std r5,-56\(r1\) +.*: (f8 c1 ff d0|d0 ff c1 f8) std r6,-48\(r1\) +.*: (f8 e1 ff d8|d8 ff e1 f8) std r7,-40\(r1\) +.*: (f9 01 ff e0|e0 ff 01 f9) std r8,-32\(r1\) +.*: (f9 21 ff e8|e8 ff 21 f9) std r9,-24\(r1\) +.*: (f9 41 ff f0|f0 ff 41 f9) std r10,-16\(r1\) +.*: (f9 61 ff f8|f8 ff 61 f9) std r11,-8\(r1\) +.*: (f8 21 ff a1|a1 ff 21 f8) stdu r1,-96\(r1\) +.*: (48 00 00 35|35 00 00 48) bl .* <__tls_get_addr> +.*: (e8 81 00 20|20 00 81 e8) ld r4,32\(r1\) +.*: (e8 a1 00 28|28 00 a1 e8) ld r5,40\(r1\) +.*: (e8 c1 00 30|30 00 c1 e8) ld r6,48\(r1\) +.*: (e8 e1 00 38|38 00 e1 e8) ld r7,56\(r1\) +.*: (e9 01 00 40|40 00 01 e9) ld r8,64\(r1\) +.*: (e9 21 00 48|48 00 21 e9) ld r9,72\(r1\) +.*: (e9 41 00 50|50 00 41 e9) ld r10,80\(r1\) +.*: (e9 61 00 58|58 00 61 e9) ld r11,88\(r1\) +.*: (38 21 00 60|60 00 21 38) addi r1,r1,96 +.*: (e8 01 00 10|10 00 01 e8) ld r0,16\(r1\) +.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0 +.*: (4e 80 00 20|20 00 80 4e) blr + +0+10000160 <__tls_get_addr>: +.*: (4e 80 00 20|20 00 80 4e) blr + +0+10000164 <_start>: +.*: (38 62 80 08|08 80 62 38) addi r3,r2,-32760 +.*: (4b ff ff 99|99 ff ff 4b) bl .* <__tls_get_addr_desc> +.*: (60 00 00 00|00 00 00 60) nop diff --git a/ld/testsuite/ld-powerpc/tlsdesc3.wf b/ld/testsuite/ld-powerpc/tlsdesc3.wf new file mode 100644 index 0000000..af5a6b4 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdesc3.wf @@ -0,0 +1,43 @@ +Contents of the \.eh_frame section: + +0+ 0+10 0+ CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 65 + Augmentation data: 1b + DW_CFA_def_cfa: r1 ofs 0 + +0+14 0+34 0+18 FDE cie=0+ pc=0+10000100\.\.0+10000160 + DW_CFA_advance_loc: 44 to 0+1000012c + DW_CFA_def_cfa_offset: 96 + DW_CFA_offset_extended_sf: r65 at cfa\+16 + DW_CFA_offset: r4 at cfa-64 + DW_CFA_offset: r5 at cfa-56 + DW_CFA_offset: r6 at cfa-48 + DW_CFA_offset: r7 at cfa-40 + DW_CFA_offset: r8 at cfa-32 + DW_CFA_offset: r9 at cfa-24 + DW_CFA_offset: r10 at cfa-16 + DW_CFA_offset: r11 at cfa-8 + DW_CFA_advance_loc: 40 to 0+10000154 + DW_CFA_def_cfa_offset: 0 + DW_CFA_restore: r4 + DW_CFA_restore: r5 + DW_CFA_restore: r6 + DW_CFA_restore: r7 + DW_CFA_restore: r8 + DW_CFA_restore: r9 + DW_CFA_restore: r10 + DW_CFA_restore: r11 + DW_CFA_advance_loc: 8 to 0+1000015c + DW_CFA_restore_extended: r65 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 0+10 0+50 FDE cie=0+ pc=0+10000164\.\.0+10000170 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-powerpc/tlsdesc4.d b/ld/testsuite/ld-powerpc/tlsdesc4.d new file mode 100644 index 0000000..eb162bb --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdesc4.d @@ -0,0 +1,46 @@ + +.*: file format .* + +Disassembly of section \.text: + +0+10000100 <__tls_get_addr_desc>: +.*: (7c 08 02 a6|a6 02 08 7c) mflr r0 +.*: (f8 01 00 10|10 00 01 f8) std r0,16\(r1\) +.*: (f8 81 ff c0|c0 ff 81 f8) std r4,-64\(r1\) +.*: (f8 a1 ff c8|c8 ff a1 f8) std r5,-56\(r1\) +.*: (f8 c1 ff d0|d0 ff c1 f8) std r6,-48\(r1\) +.*: (f8 e1 ff d8|d8 ff e1 f8) std r7,-40\(r1\) +.*: (f9 01 ff e0|e0 ff 01 f9) std r8,-32\(r1\) +.*: (f9 21 ff e8|e8 ff 21 f9) std r9,-24\(r1\) +.*: (f9 41 ff f0|f0 ff 41 f9) std r10,-16\(r1\) +.*: (f9 61 ff f8|f8 ff 61 f9) std r11,-8\(r1\) +.*: (f8 21 ff a1|a1 ff 21 f8) stdu r1,-96\(r1\) +.*: (48 00 00 35|35 00 00 48) bl .* <__tls_get_addr> +.*: (e8 81 00 20|20 00 81 e8) ld r4,32\(r1\) +.*: (e8 a1 00 28|28 00 a1 e8) ld r5,40\(r1\) +.*: (e8 c1 00 30|30 00 c1 e8) ld r6,48\(r1\) +.*: (e8 e1 00 38|38 00 e1 e8) ld r7,56\(r1\) +.*: (e9 01 00 40|40 00 01 e9) ld r8,64\(r1\) +.*: (e9 21 00 48|48 00 21 e9) ld r9,72\(r1\) +.*: (e9 41 00 50|50 00 41 e9) ld r10,80\(r1\) +.*: (e9 61 00 58|58 00 61 e9) ld r11,88\(r1\) +.*: (38 21 00 60|60 00 21 38) addi r1,r1,96 +.*: (e8 01 00 10|10 00 01 e8) ld r0,16\(r1\) +.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0 +.*: (4e 80 00 20|20 00 80 4e) blr + +0+10000160 <__tls_get_addr>: +.*: (4e 80 00 20|20 00 80 4e) blr + +0+10000164 <_start>: +.*: (38 62 80 08|08 80 62 38) addi r3,r2,-32760 +.*: (4b ff ff 99|99 ff ff 4b) bl .* <__tls_get_addr_desc> +.*: (60 00 00 00|00 00 00 60) nop + \.\.\. + +0+12000100 <.*\.long_branch\.__tls_get_addr_desc>: +.*: (4a 00 00 00|00 00 00 4a) b .* <__tls_get_addr_desc> + \.\.\. +.*: (38 62 80 08|08 80 62 38) addi r3,r2,-32760 +.*: (4b ff ff dd|dd ff ff 4b) bl .* <.*\.long_branch\.__tls_get_addr_desc> +.*: (60 00 00 00|00 00 00 60) nop diff --git a/ld/testsuite/ld-powerpc/tlsdesc4.s b/ld/testsuite/ld-powerpc/tlsdesc4.s new file mode 100644 index 0000000..6dc3082 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdesc4.s @@ -0,0 +1,18 @@ + .text + .globl _start +_start: + .cfi_startproc + addi 3,2,gd@got@tlsgd + bl __tls_get_addr_desc(gd@tlsgd) + nop + .cfi_endproc + + .section .text.pad1,"ax" + .space 0x1ffff90 + + .section .text.far,"ax" + .cfi_startproc + addi 3,2,gd@got@tlsgd + bl __tls_get_addr_desc(gd@tlsgd) + nop + .cfi_endproc diff --git a/ld/testsuite/ld-powerpc/tlsdesc4.wf b/ld/testsuite/ld-powerpc/tlsdesc4.wf new file mode 100644 index 0000000..8d24979 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsdesc4.wf @@ -0,0 +1,49 @@ +Contents of the \.eh_frame section: + +0+ 0+10 0+ CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 65 + Augmentation data: 1b + DW_CFA_def_cfa: r1 ofs 0 + +0+14 0+34 0+18 FDE cie=0+ pc=0+10000100..0+10000160 + DW_CFA_advance_loc: 44 to 0+1000012c + DW_CFA_def_cfa_offset: 96 + DW_CFA_offset_extended_sf: r65 at cfa\+16 + DW_CFA_offset: r4 at cfa-64 + DW_CFA_offset: r5 at cfa-56 + DW_CFA_offset: r6 at cfa-48 + DW_CFA_offset: r7 at cfa-40 + DW_CFA_offset: r8 at cfa-32 + DW_CFA_offset: r9 at cfa-24 + DW_CFA_offset: r10 at cfa-16 + DW_CFA_offset: r11 at cfa-8 + DW_CFA_advance_loc: 40 to 0+10000154 + DW_CFA_def_cfa_offset: 0 + DW_CFA_restore: r4 + DW_CFA_restore: r5 + DW_CFA_restore: r6 + DW_CFA_restore: r7 + DW_CFA_restore: r8 + DW_CFA_restore: r9 + DW_CFA_restore: r10 + DW_CFA_restore: r11 + DW_CFA_advance_loc: 8 to 0+1000015c + DW_CFA_restore_extended: r65 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 0+10 0+50 FDE cie=0+ pc=0+10000164..0+10000170 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+60 0+10 0+64 FDE cie=0+ pc=0+12000120..0+1200012c + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + |