aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-powerpc/powerpc.exp
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-24 16:32:57 +0930
committerAlan Modra <amodra@gmail.com>2020-08-24 21:15:06 +0930
commit252dcdf432c67f6baafb766ed068c64db1eb2bad (patch)
treef065483aba2070e20ef18b2c5cb711b82bb6041c /ld/testsuite/ld-powerpc/powerpc.exp
parentf16c3d4f137ae02fab0982782b2e1c2b2afc8583 (diff)
downloadgdb-252dcdf432c67f6baafb766ed068c64db1eb2bad.zip
gdb-252dcdf432c67f6baafb766ed068c64db1eb2bad.tar.gz
gdb-252dcdf432c67f6baafb766ed068c64db1eb2bad.tar.bz2
PowerPC TPREL_HA/LO optimisation
ppc64 ld optimises sequences like the following addis 3,13,wot@tprel@ha lwz 3,wot@tprel@l(3) to nop lwz 3,wot@tprel(13) when "wot" is located near enough to the thread pointer. However, the ABI doesn't require that R_PPC64_TPREL16_HA always be on an addis rt,13,imm instruction, and while ld checked for that on the high-part instruction it didn't disable the optimisation on the low-part instruction. This patch fixes that problem, disabling the tprel optimisation globally if high-part instructions don't pass sanity checks. The optimisation is also enabled for ppc32, where before ld.bfd had the code in the wrong place and ld.gold had it in a block only enabled for ppc64. bfd/ * elf32-ppc.c (ppc_elf_check_relocs): Set has_tls_reloc for high part tprel16 relocs. (ppc_elf_tls_optimize): Sanity check high part tprel16 relocs. Clear do_tls_opt on odd instructions. (ppc_elf_relocate_section): Move TPREL16_HA/LO optimisation later. Don't sanity check them here. * elf64-ppc.c (ppc64_elf_check_relocs): Set has_tls_reloc for high part tprel16 relocs. (ppc64_elf_tls_optimize): Sanity check high part tprel16 relocs. Clear do_tls_opt on odd instructions. (ppc64_elf_relocate_section): Don't sanity check TPREL16_HA. ld/ * testsuite/ld-powerpc/tls32.d: Update for TPREL_HA/LO optimisation. * testsuite/ld-powerpc/tlsexe32.d: Likewise. * testsuite/ld-powerpc/tlsldopt32.d: Likewise. * testsuite/ld-powerpc/tlsmark32.d: Likewise. * testsuite/ld-powerpc/tlsopt4_32.d: Likewise. * testsuite/ld-powerpc/tprel.s, * testsuite/ld-powerpc/tprel.d, * testsuite/ld-powerpc/tprel32.d: New tests. * testsuite/ld-powerpc/tprelbad.s, * testsuite/ld-powerpc/tprelbad.d: New test. * testsuite/ld-powerpc/powerpc.exp: Run them. gold/ * powerpc.cc (Target_powerpc): Add tprel_opt_ and accessors. (Target_powerpc::Scan::local): Sanity check tprel high relocs. (Target_powerpc::Scan::global): Likewise. (Target_powerpc::Relocate::relocate): Control tprel optimisation with tprel_opt_ and enable for 32-bit.
Diffstat (limited to 'ld/testsuite/ld-powerpc/powerpc.exp')
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp4
1 files changed, 4 insertions, 0 deletions
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index a4c060a..7a49b1a 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -419,6 +419,7 @@ if [ supports_ppc64 ] then {
run_dump_test "tlsld"
run_dump_test "tlsie"
run_dump_test "non-contiguous-powerpc64"
+ run_dump_test "tprel"
}
run_dump_test "localgot"
@@ -459,3 +460,6 @@ run_dump_test "ppc476-shared"
run_dump_test "ppc476-shared2"
run_dump_test "non-contiguous-powerpc"
+
+run_dump_test "tprel32"
+run_dump_test "tprelbad"