From: Maciej W. Rozycki Date: Fri, 28 Jul 2023 05:00:36 +0000 (+0100) Subject: MIPS/LD/testsuite: Fix unaligned JALX failures with OpenBSD targets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=67e789ae32fadc540c10839f08ad53ff01e2d732;p=binutils-gdb.git MIPS/LD/testsuite: Fix unaligned JALX failures with OpenBSD targets There are only n64 linker emulations included with `mips64*-*-openbsd*' targets, however the unaligned JALX tests insist on running across all targets and force the n32 ABI, causing link errors with the targets concerned, e.g.: ./ld-new: tmpdir/unaligned-jalx-0.o: ABI is incompatible with that of the selected emulation ./ld-new: failed to merge target specific data of file tmpdir/unaligned-jalx-0.o ./ld-new: tmpdir/unaligned-insn.o: ABI is incompatible with that of the selected emulation ./ld-new: failed to merge target specific data of file tmpdir/unaligned-insn.o Convert the tests then to use the per-ABI framework and run them for the o32 and n32 ABIs, removing these regressions: mips64-openbsd -FAIL: MIPS JALX to unaligned symbol 0 mips64-openbsd -FAIL: MIPS JALX to unaligned symbol 1 mips64-openbsd -FAIL: MIPS JALX to unaligned symbol 2 mips64-openbsd -FAIL: MIPS JALX to unaligned symbol 3 mips64-openbsd -FAIL: MIPS16 JALX to unaligned symbol 0 mips64-openbsd -FAIL: MIPS16 JALX to unaligned symbol 1 mips64-openbsd -FAIL: microMIPS JALX to unaligned symbol 0 mips64-openbsd -FAIL: microMIPS JALX to unaligned symbol 1 mips64el-openbsd -FAIL: MIPS JALX to unaligned symbol 0 mips64el-openbsd -FAIL: MIPS JALX to unaligned symbol 1 mips64el-openbsd -FAIL: MIPS JALX to unaligned symbol 2 mips64el-openbsd -FAIL: MIPS JALX to unaligned symbol 3 mips64el-openbsd -FAIL: MIPS16 JALX to unaligned symbol 0 mips64el-openbsd -FAIL: MIPS16 JALX to unaligned symbol 1 mips64el-openbsd -FAIL: microMIPS JALX to unaligned symbol 0 mips64el-openbsd -FAIL: microMIPS JALX to unaligned symbol 1 Similar tests for the n64 ABI can be added separately, using suitable dump patterns. ld/ * testsuite/ld-mips-elf/unaligned-jalx-0.d: Remove `-32' from the `as' tag. * testsuite/ld-mips-elf/unaligned-jalx-1.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-2.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-3.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d: Likewise. * testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d: Likewise. * testsuite/ld-mips-elf/mips-elf.exp: Run unaligned JALX tests with `run_dump_test_o32' and `run_dump_test_n32' rather than `run_dump_test'. --- diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 44f9dc95c44..903f7a0a383 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -412,14 +412,22 @@ run_dump_test_n64 "bal-jalx-pic-micromips-n64" run_dump_test_n64 "bal-jalx-pic-ignore-n64" run_dump_test_n64 "bal-jalx-pic-ignore-micromips-n64" -run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-1" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-2" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-3" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-mips16-0" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-mips16-1" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-micromips-0" [list [list ld $abi_ldflags(o32)]] -run_dump_test "unaligned-jalx-micromips-1" [list [list ld $abi_ldflags(o32)]] +run_dump_test_o32 "unaligned-jalx-0" +run_dump_test_n32 "unaligned-jalx-0" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-1" +run_dump_test_n32 "unaligned-jalx-1" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-2" +run_dump_test_n32 "unaligned-jalx-2" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-3" +run_dump_test_n32 "unaligned-jalx-3" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-mips16-0" +run_dump_test_n32 "unaligned-jalx-mips16-0" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-mips16-1" +run_dump_test_n32 "unaligned-jalx-mips16-1" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-micromips-0" +run_dump_test_n32 "unaligned-jalx-micromips-0" [list [list name (n32)]] +run_dump_test_o32 "unaligned-jalx-micromips-1" +run_dump_test_n32 "unaligned-jalx-micromips-1" [list [list name (n32)]] run_dump_test_n32 "unaligned-jalx-addend-0" run_dump_test_n32 "unaligned-jalx-addend-1" diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-0.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-0.d index a37e5a914f7..ad08694c95d 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-0.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-0.d @@ -1,7 +1,7 @@ #name: MIPS JALX to unaligned symbol 0 #source: unaligned-jalx-0.s #source: unaligned-insn.s -mips16 -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #objdump: -dr --prefix-addresses --show-raw-insn diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-1.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-1.d index a6cc2ed01f2..260124a0c06 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-1.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-1.d @@ -1,7 +1,7 @@ #name: MIPS JALX to unaligned symbol 1 #source: unaligned-jalx-1.s #source: unaligned-insn.s -mips16 -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #error: \A[^\n]*: in function `foo':\n #error: \(\.text\+0x[0-9a-f]+\): cannot convert a jump to JALX for a non-word-aligned address\Z diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d index 718c53d6c9f..f4552c34307 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d @@ -1,7 +1,7 @@ #name: MIPS JALX to unaligned symbol 2 #source: unaligned-jalx-2.s #source: unaligned-insn.s -mips16 -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #objdump: -dr --prefix-addresses --show-raw-insn #dump: unaligned-jalx-0.d diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d index 36327f8c452..7cdcc8e6228 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d @@ -1,7 +1,7 @@ #name: MIPS JALX to unaligned symbol 3 #source: unaligned-jalx-3.s #source: unaligned-insn.s -mips16 -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #error: \A[^\n]*: in function `foo':\n #error: \(\.text\+0x0\): cannot convert a branch to JALX for a non-word-aligned address\Z diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d index 2622103bd7e..d76b53a5a21 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d @@ -1,7 +1,7 @@ #name: microMIPS JALX to unaligned symbol 0 #source: unaligned-jalx-0.s -mmicromips #source: unaligned-insn.s -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #objdump: -dr --prefix-addresses --show-raw-insn diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d index c38b2d5266b..f40a6713dd1 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d @@ -1,7 +1,7 @@ #name: microMIPS JALX to unaligned symbol 1 #source: unaligned-jalx-1.s -mmicromips #source: unaligned-insn.s -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #error: \A[^\n]*: in function `foo':\n #error: \(\.text\+0x[0-9a-f]+\): cannot convert a jump to JALX for a non-word-aligned address\Z diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d index 176680d64c7..c560fe4c18b 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d @@ -1,7 +1,7 @@ #name: MIPS16 JALX to unaligned symbol 0 #source: unaligned-jalx-0.s -mips16 #source: unaligned-insn.s -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #objdump: -dr --prefix-addresses --show-raw-insn diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d index aacf08925c3..b810f01de29 100644 --- a/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d +++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d @@ -1,7 +1,7 @@ #name: MIPS16 JALX to unaligned symbol 1 #source: unaligned-jalx-1.s -mips16 #source: unaligned-insn.s -#as: -EB -32 +#as: -EB #ld: -EB -Ttext 0x1c000000 -e 0x1c000000 #error: \A[^\n]*: in function `foo':\n #error: \(\.text\+0x[0-9a-f]+\): cannot convert a jump to JALX for a non-word-aligned address\Z