aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-powerpc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-08-01 12:14:22 +0930
committerAlan Modra <amodra@gmail.com>2018-08-01 12:14:22 +0930
commit1aa4214141d30f99f941266a3bedbc332d674c04 (patch)
tree4b9c07e9ab01128626d55d0d2e5ec6a1e55af98c /ld/testsuite/ld-powerpc
parentcb86a42aba5b6e1c135433e1c0c26223fd0f7a7f (diff)
downloadgdb-1aa4214141d30f99f941266a3bedbc332d674c04.zip
gdb-1aa4214141d30f99f941266a3bedbc332d674c04.tar.gz
gdb-1aa4214141d30f99f941266a3bedbc332d674c04.tar.bz2
PowerPC64 __tls_get_addr_opt stub .eh_frame fix
This patch sets stub_offset in ppc_size_one_stub rather than in ppc_build_one_stub. That allows the plt stub alignment to be done in just ppc_size_one_stub rather than both functions. The patch also corrects the place where the alignment was done, fixing a possible error in .eh_frame data, and tidies some offset calculations. bfd/ * elf64-ppc.c (plt_stub_pad): Delay plt_stub_size call until needed. (ppc_build_one_stub): Don't set stub_offset, instead assert that it is sane. Don't adjust stub_offset for alignment. Adjust size calculation. Use "targ" temp when calculating offsets. (ppc_size_one_stub): Set stub_offset here. Use "targ" temp when calculating offsets. Adjust for alignment before setting tls_get_addr_opt_bctrl. ld/ * testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with plt alignment. * testsuite/ld-powerpc/tlsopt5.s: Add extra call. * testsuite/ld-powerpc/tlsopt5.wf: Adjust expected output. * testsuite/ld-powerpc/tlsopt5.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-powerpc')
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp2
-rw-r--r--ld/testsuite/ld-powerpc/tlsopt5.d20
-rw-r--r--ld/testsuite/ld-powerpc/tlsopt5.s3
-rw-r--r--ld/testsuite/ld-powerpc/tlsopt5.wf3
4 files changed, 22 insertions, 6 deletions
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index cfeb277..ed7bc74 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -224,7 +224,7 @@ set ppc64elftests {
"tlsopt4"}
{"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s}
{} "tlsdll.so"}
- {"TLS opt 5" "-melf64ppc --no-plt-align -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
+ {"TLS opt 5" "-melf64ppc -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
{{objdump -dr tlsopt5.d} {readelf -wf tlsopt5.wf}}
"tlsopt5"}
{"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s}
diff --git a/ld/testsuite/ld-powerpc/tlsopt5.d b/ld/testsuite/ld-powerpc/tlsopt5.d
index 4521a9b..4caf183 100644
--- a/ld/testsuite/ld-powerpc/tlsopt5.d
+++ b/ld/testsuite/ld-powerpc/tlsopt5.d
@@ -8,6 +8,13 @@
Disassembly of section \.text:
+.* <.*\.plt_call\.foo>:
+.*: (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
+.*: (20 04 80 4e|4e 80 04 20) bctr
+ \.\.\.
+
.* <.*\.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\)
@@ -19,17 +26,21 @@ Disassembly of section \.text:
.*: (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\)
+.*: (30 80 82 e9|e9 82 80 30) ld r12,-32720\(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
+ \.\.\.
.* <_start>:
.*: (08 80 62 38|38 62 80 08) addi r3,r2,-32760
-.*: (b9 ff ff 4b|4b ff ff b9) bl .*
+.*: (9d ff ff 4b|4b ff ff 9d) bl .* <.*\.plt_call\.__tls_get_addr_opt@@GLIBC_2\.22>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (75 ff ff 4b|4b ff ff 75) bl .* <.*\.plt_call\.foo>
+.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
.*: (00 00 00 60|60 00 00 00) nop
.*
.*
@@ -50,5 +61,8 @@ Disassembly of section \.text:
.*: (08 00 6b e9|e9 6b 00 08) ld r11,8\(r11\)
.*: (20 04 80 4e|4e 80 04 20) bctr
+.* <foo@plt>:
+.* (c8 ff ff 4b|4b ff ff c8) b .*
+
.* <__tls_get_addr_opt@plt>:
-.*: (c8 ff ff 4b|4b ff ff c8) b .*
+.*: (c4 ff ff 4b|4b ff ff c4) b .*
diff --git a/ld/testsuite/ld-powerpc/tlsopt5.s b/ld/testsuite/ld-powerpc/tlsopt5.s
index 70902ef..7cb82db 100644
--- a/ld/testsuite/ld-powerpc/tlsopt5.s
+++ b/ld/testsuite/ld-powerpc/tlsopt5.s
@@ -1,7 +1,10 @@
.globl _start
+ .weak foo
_start:
.cfi_startproc
addi 3,2,gd@got@tlsgd
bl __tls_get_addr(gd@tlsgd)
nop
+ bl foo
+ nop
.cfi_endproc
diff --git a/ld/testsuite/ld-powerpc/tlsopt5.wf b/ld/testsuite/ld-powerpc/tlsopt5.wf
index af8cb76..f045361 100644
--- a/ld/testsuite/ld-powerpc/tlsopt5.wf
+++ b/ld/testsuite/ld-powerpc/tlsopt5.wf
@@ -7,11 +7,10 @@ Contents of the \.eh_frame section:
Data alignment factor: -8
Return address column: 65
Augmentation data: 1b
-
DW_CFA_def_cfa: r1 ofs 0
0+14 0+14 0+18 FDE cie=0+ pc=.*
- DW_CFA_advance_loc: 48 to .*
+ DW_CFA_advance_loc: 80 to .*
DW_CFA_offset_extended_sf: r65 at cfa\+8
DW_CFA_advance_loc: 16 to .*
DW_CFA_restore_extended: r65