binutils-gdb/ld/testsuite/ld-powerpc/notoc2.d
Alan Modra 3cd7c7d7ef PPC64_OPT_LOCALENTRY is incompatible with tail calls
The save of r2 in __glink_PLTresolve is the culprit.  Remove it,
unless we know we need it for --plt-localentry.  --plt-localentry
should not be used with power10 pc-relative code that makes tail
calls.

The patch also removes use of r2 as a scratch reg in the ELFv2
__glink_PLTresolve.  Using r2 isn't a problem, this is just reducing
the number of scratch regs.

bfd/
	* elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Depend on has_plt_localentry0.
	(LD_R0_0R11, ADD_R11_R0_R11): Define.
	(ppc64_elf_tls_setup): Disable params->plt_localentry0 when power10
	code detected.
	(ppc64_elf_size_stubs): Update __glink_PLTresolve eh_frame.
	(ppc64_elf_build_stubs): Move r2 save to start of __glink_PLTresolve,
	and only emit for has_plt_localentry0.  Don't use r2 in the stub.
ld/
	* testsuite/ld-powerpc/elfv2so.d,
	* testsuite/ld-powerpc/notoc2.d,
	* testsuite/ld-powerpc/tlsdesc.wf,
	* testsuite/ld-powerpc/tlsdesc2.d,
	* testsuite/ld-powerpc/tlsdesc2.wf,
	* testsuite/ld-powerpc/tlsopt5.d,
	* testsuite/ld-powerpc/tlsopt5.wf,
	* testsuite/ld-powerpc/tlsopt6.d,
	* testsuite/ld-powerpc/tlsopt6.wf: Update __glink_PLTresolve.
2020-09-26 19:03:02 +09:30

30 lines
821 B
Makefile

#source: notoc2.s
#as: -a64 -mpower10
#ld: -shared -z norelro
#objdump: -d -Mpower10
#target: powerpc64*-*-*
.*
Disassembly of section \.text:
.* <.*\.plt_call\.puts>:
.*: (04 10 00 01|01 00 10 04) pld r12,66200
.*: (e5 80 02 98|98 02 80 e5)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
#...
.*: (04 13 ff ff|ff ff 13 04) pld r12,-1
.*: (e5 80 ff ff|ff ff 80 e5)
.*: (04 10 00 00|00 00 10 04) pld r12,0
.*: (e5 80 00 00|00 00 80 e5)
.*: (06 13 ff ff|ff ff 13 06) pla r12,-1
.*: (39 80 ff ff|ff ff 80 39)
.*: (06 10 00 00|00 00 10 06) pla r12,0
.*: (39 80 00 00|00 00 80 39)
.*: (06 10 00 00|00 00 10 06) pla r3,88
.*: (38 60 00 58|58 00 60 38)
.*: (4b ff ff 99|99 ff ff 4b) bl .* <.*\.plt_call\.puts>
.*: (60 00 00 00|00 00 00 60) nop
#pass