From 82d808edbc7a06f706b82064cec6c3ed88f0c4be Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 3 May 2017 00:05:15 +0100 Subject: [PATCH] MIPS16/GAS: Fix absolute references with PC-relative synthetic instructions Complement commit 88a7ef168927 ("MIPS16/GAS: Restore unsupported relocation diagnostics") and also propagate constant expressions, either already reduced from absolute symbol references or created from literals in the first place, used as a PC-relative operand with the MIPS16 LA, LW, DLA and LD synthetic instructions to relaxation, matching the way forward absolute symbol references have been handled as from the commit referred and letting relaxation produce any necessary relocations, if possible, for the absolute value requested to be reproduced at the run time. Call `symbol_append' for any expression symbol created for the purpose of MIPS16 relaxation as with constant expressions now propagated from earlier on such symbols may make it through and have R_MIPS16_PC16_S1 relocations emitted against, and therefore need to appear in the symbol table produced. gas/ * config/tc-mips.c (append_insn): Call `symbol_append' for any expression symbol created for MIPS16 relaxation. (match_mips16_insn): Don't encode a constant value as an immediate with a PC-relative operand. * testsuite/gas/mips/mips16-pcrel-absolute-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-2.d: New test. * testsuite/gas/mips/mips16-branch-absolute-addend-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-n32-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-n32-2.d: New test. * testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-n64-1.d: New test. * testsuite/gas/mips/mips16-branch-absolute-n64-2.d: New test. * testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d: New test. * testsuite/gas/mips/mips16-pcrel-absolute-1.l: New stderr output. * testsuite/gas/mips/mips16-pcrel-absolute-1.s: New test source. * testsuite/gas/mips/mips16-branch-absolute-1.s: New test source. * testsuite/gas/mips/mips16-branch-absolute-2.s: New test source. * testsuite/gas/mips/mips16-branch-absolute-addend-1.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/mips16-branch-absolute-1.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-2.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d: New test. * testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. --- gas/ChangeLog | 31 +++++++++++++++++++ gas/config/tc-mips.c | 7 ++++- gas/testsuite/gas/mips/mips.exp | 10 ++++++ .../gas/mips/mips16-branch-absolute-1.d | 20 ++++++++++++ .../gas/mips/mips16-branch-absolute-1.s | 22 +++++++++++++ .../gas/mips/mips16-branch-absolute-2.d | 4 +++ .../gas/mips/mips16-branch-absolute-2.s | 20 ++++++++++++ .../mips/mips16-branch-absolute-addend-1.d | 4 +++ .../mips/mips16-branch-absolute-addend-1.s | 22 +++++++++++++ .../mips16-branch-absolute-addend-n32-1.d | 5 +++ .../mips16-branch-absolute-addend-n64-1.d | 5 +++ .../gas/mips/mips16-branch-absolute-n32-1.d | 5 +++ .../gas/mips/mips16-branch-absolute-n32-2.d | 5 +++ .../gas/mips/mips16-branch-absolute-n64-1.d | 5 +++ .../gas/mips/mips16-branch-absolute-n64-2.d | 5 +++ .../gas/mips/mips16-pcrel-absolute-1.d | 3 ++ .../gas/mips/mips16-pcrel-absolute-1.l | 3 ++ .../gas/mips/mips16-pcrel-absolute-1.s | 18 +++++++++++ ld/ChangeLog | 20 ++++++++++++ ld/testsuite/ld-mips-elf/mips-elf.exp | 16 ++++++++++ .../ld-mips-elf/mips16-branch-absolute-1.d | 6 ++++ .../ld-mips-elf/mips16-branch-absolute-2.d | 6 ++++ .../mips16-branch-absolute-addend-1.d | 6 ++++ .../mips16-branch-absolute-addend-n32-1.d | 6 ++++ .../mips16-branch-absolute-addend-n64-1.d | 6 ++++ .../mips16-branch-absolute-n32-1.d | 6 ++++ .../mips16-branch-absolute-n32-2.d | 6 ++++ .../mips16-branch-absolute-n64-1.d | 6 ++++ .../mips16-branch-absolute-n64-2.d | 6 ++++ 29 files changed, 283 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-1.s create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-2.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-2.s create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-n32-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-n32-2.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-n64-1.d create mode 100644 gas/testsuite/gas/mips/mips16-branch-absolute-n64-2.d create mode 100644 gas/testsuite/gas/mips/mips16-pcrel-absolute-1.d create mode 100644 gas/testsuite/gas/mips/mips16-pcrel-absolute-1.l create mode 100644 gas/testsuite/gas/mips/mips16-pcrel-absolute-1.s create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-2.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d diff --git a/gas/ChangeLog b/gas/ChangeLog index d5849c0849e..24155f15441 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,34 @@ +2017-05-02 Maciej W. Rozycki + + * config/tc-mips.c (append_insn): Call `symbol_append' for any + expression symbol created for MIPS16 relaxation. + (match_mips16_insn): Don't encode a constant value as an + immediate with a PC-relative operand. + + * testsuite/gas/mips/mips16-pcrel-absolute-1.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-1.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-2.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-addend-1.d: New + test. + * testsuite/gas/mips/mips16-branch-absolute-n32-1.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-n32-2.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d: New + test. + * testsuite/gas/mips/mips16-branch-absolute-n64-1.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-n64-2.d: New test. + * testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d: New + test. + * testsuite/gas/mips/mips16-pcrel-absolute-1.l: New stderr + output. + * testsuite/gas/mips/mips16-pcrel-absolute-1.s: New test source. + * testsuite/gas/mips/mips16-branch-absolute-1.s: New test + source. + * testsuite/gas/mips/mips16-branch-absolute-2.s: New test + source. + * testsuite/gas/mips/mips16-branch-absolute-addend-1.s: New test + source. + * testsuite/gas/mips/mips.exp: Run the new tests. + 2017-04-27 Maciej W. Rozycki * config/tc-mips.c (mips16_pcrel_val): New function, factored diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index fbf67a139ed..8c387baef3f 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -7419,6 +7419,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, else { symbol = make_expr_symbol (address_expr); + symbol_append (symbol, symbol_lastP, &symbol_rootP, &symbol_lastP); offset = 0; } add_relaxed_insn (ip, 4, 0, @@ -8087,6 +8088,7 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, const char *args; const struct mips_operand *operand; const struct mips_operand *ext_operand; + bfd_boolean pcrel = FALSE; int required_insn_length; struct mips_arg_info arg; int relax_char; @@ -8148,6 +8150,7 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, } else if (relax_char && offset_expr.X_op == O_constant + && !pcrel && calculate_reloc (*offset_reloc, offset_expr.X_add_number, &value)) @@ -8216,7 +8219,9 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, if (!operand) abort (); - if (operand->type != OP_PCREL) + if (operand->type == OP_PCREL) + pcrel = TRUE; + else { ext_operand = decode_mips16_operand (c, TRUE); if (operand != ext_operand) diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 30e2342a977..a46f7c25699 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1544,6 +1544,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "mips16-pcrel-addend-2" run_dump_test "mips16-pcrel-addend-3" run_dump_test "mips16-pcrel-absolute" + run_dump_test "mips16-pcrel-absolute-1" run_dump_test "mips16-branch-reloc-0" run_dump_test "mips16-branch-reloc-1" run_dump_test "mips16-branch-reloc-2" @@ -1555,12 +1556,21 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "mips16-branch-addend-4" run_dump_test "mips16-branch-addend-5" run_dump_test "mips16-branch-absolute" + run_dump_test "mips16-branch-absolute-1" + run_dump_test "mips16-branch-absolute-2" run_dump_test "mips16-branch-absolute-addend" + run_dump_test "mips16-branch-absolute-addend-1" if $has_newabi { run_dump_test "mips16-branch-absolute-n32" + run_dump_test "mips16-branch-absolute-n32-1" + run_dump_test "mips16-branch-absolute-n32-2" run_dump_test "mips16-branch-absolute-addend-n32" + run_dump_test "mips16-branch-absolute-addend-n32-1" run_dump_test "mips16-branch-absolute-n64" + run_dump_test "mips16-branch-absolute-n64-1" + run_dump_test "mips16-branch-absolute-n64-2" run_dump_test "mips16-branch-absolute-addend-n64" + run_dump_test "mips16-branch-absolute-addend-n64-1" } run_dump_test "mips16-absolute-reloc-0" run_dump_test "mips16-absolute-reloc-1" diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-1.d new file mode 100644 index 00000000000..539bc908f30 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-1.d @@ -0,0 +1,20 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 1 +#as: -32 + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> f7ff 101e b 00001000 +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 L0\001 +[0-9a-f]+ <[^>]*> f7ff 601e bteqz 00001004 +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 L0\001 +[0-9a-f]+ <[^>]*> f7ff 611e btnez 00001008 +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 L0\001 +[0-9a-f]+ <[^>]*> f7ff 221e beqz v0,0000100c +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 L0\001 +[0-9a-f]+ <[^>]*> f7ff 2a1e bnez v0,00001010 +[ ]*[0-9a-f]+: R_MIPS16_PC16_S1 L0\001 +[0-9a-f]+ <[^>]*> 6500 nop + \.\.\. diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-1.s b/gas/testsuite/gas/mips/mips16-branch-absolute-1.s new file mode 100644 index 00000000000..dc7ee4d7ba0 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-1.s @@ -0,0 +1,22 @@ + .text + + .space 0x1000 + + .set bar, 0x1235 + + .globl foo + .ent foo + .set mips16 +foo: + b bar + bteqz bar + btnez bar + beqz $2, bar + bnez $2, bar + nop + .set nomips16 + .end foo + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-2.d b/gas/testsuite/gas/mips/mips16-branch-absolute-2.d new file mode 100644 index 00000000000..49a331fd694 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-2.d @@ -0,0 +1,4 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 2 +#as: -32 +#dump: mips16-branch-absolute-1.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-2.s b/gas/testsuite/gas/mips/mips16-branch-absolute-2.s new file mode 100644 index 00000000000..64aebb471c5 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-2.s @@ -0,0 +1,20 @@ + .text + + .space 0x1000 + + .globl foo + .ent foo + .set mips16 +foo: + b 0x1235 + bteqz 0x1235 + btnez 0x1235 + beqz $2, 0x1235 + bnez $2, 0x1235 + nop + .set nomips16 + .end foo + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.d new file mode 100644 index 00000000000..66841c392b6 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.d @@ -0,0 +1,4 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression with addend 1 +#as: -32 +#dump: mips16-branch-absolute-1.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s new file mode 100644 index 00000000000..e75d7e1300b --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s @@ -0,0 +1,22 @@ + .text + + .space 0x1000 + + .set bar, 0x12345679 + + .globl foo + .ent foo + .set mips16 +foo: + b bar + 0x1234 + bteqz bar + 0x1234 + btnez bar + 0x1234 + beqz $2, bar + 0x1234 + bnez $2, bar + 0x1234 + nop + .set nomips16 + .end foo + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d new file mode 100644 index 00000000000..bf565a32517 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n32-1.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression with addend 1 (n32) +#as: -n32 -march=from-abi +#source: mips16-branch-absolute-addend-1.s +#dump: mips16-branch-absolute-addend-n32.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d new file mode 100644 index 00000000000..c9538211ba1 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-addend-n64-1.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression with addend 1 (n64) +#as: -64 -march=from-abi +#source: mips16-branch-absolute-addend-1.s +#dump: mips16-branch-absolute-addend-n64.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-n32-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-n32-1.d new file mode 100644 index 00000000000..543696deb29 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-n32-1.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 1 (n32) +#as: -n32 -march=from-abi +#source: mips16-branch-absolute-1.s +#dump: mips16-branch-absolute-n32.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-n32-2.d b/gas/testsuite/gas/mips/mips16-branch-absolute-n32-2.d new file mode 100644 index 00000000000..5d80db83032 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-n32-2.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 2 (n32) +#as: -n32 -march=from-abi +#source: mips16-branch-absolute-2.s +#dump: mips16-branch-absolute-n32.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-n64-1.d b/gas/testsuite/gas/mips/mips16-branch-absolute-n64-1.d new file mode 100644 index 00000000000..0ea0c2da9dd --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-n64-1.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 1 (n64) +#as: -64 -march=from-abi +#source: mips16-branch-absolute-1.s +#dump: mips16-branch-absolute-n64.d diff --git a/gas/testsuite/gas/mips/mips16-branch-absolute-n64-2.d b/gas/testsuite/gas/mips/mips16-branch-absolute-n64-2.d new file mode 100644 index 00000000000..7d338f3df0d --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-branch-absolute-n64-2.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 branch to absolute expression 2 (n64) +#as: -64 -march=from-abi +#source: mips16-branch-absolute-2.s +#dump: mips16-branch-absolute-n64.d diff --git a/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.d b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.d new file mode 100644 index 00000000000..d9f6fb72fd1 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.d @@ -0,0 +1,3 @@ +#name: MIPS16 PC-relative reference to absolute expression 1 +#as: -32 +#error-output: mips16-pcrel-absolute-1.l diff --git a/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.l b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.l new file mode 100644 index 00000000000..60054fa7026 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:10: Error: unsupported relocation +.*:11: Error: unsupported relocation diff --git a/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.s b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.s new file mode 100644 index 00000000000..833a967826d --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-pcrel-absolute-1.s @@ -0,0 +1,18 @@ + .text + + .space 0x1000 + + .set bar, 0x1234 + + .ent foo + .set mips16 +foo: + la $2, bar + lw $2, bar + nop + .set nomips16 + .end foo + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/ld/ChangeLog b/ld/ChangeLog index ff526083a27..92af8b90003 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,23 @@ +2017-05-02 Maciej W. Rozycki + + * testsuite/ld-mips-elf/mips16-branch-absolute-1.d: New test. + * testsuite/ld-mips-elf/mips16-branch-absolute-2.d: New test. + * testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d: New + test. + * testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d: New + test. + * testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d: New + test. + * testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d: + New test. + * testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d: New + test. + * testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d: New + test. + * testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d: + New test. + * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. + 2017-05-02 H.J. Lu * testsuite/ld-i386/tls.exp: Add -Wl,--no-as-needed to diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index f824e7ca8ad..068ea54c1c6 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -159,17 +159,33 @@ run_dump_test "mips16-branch-3" [list [list ld $abi_ldflags(o32)]] run_dump_test "mips16-branch-addend-2" [list [list ld $abi_ldflags(o32)]] run_dump_test "mips16-branch-addend-3" [list [list ld $abi_ldflags(o32)]] run_dump_test "mips16-branch-absolute" [list [list ld $abi_ldflags(o32)]] +run_dump_test "mips16-branch-absolute-1" [list [list ld $abi_ldflags(o32)]] +run_dump_test "mips16-branch-absolute-2" [list [list ld $abi_ldflags(o32)]] run_dump_test "mips16-branch-absolute-addend" \ [list [list ld $abi_ldflags(o32)]] +run_dump_test "mips16-branch-absolute-addend-1" \ + [list [list ld $abi_ldflags(o32)]] if $has_newabi { run_dump_test "mips16-branch-absolute-n32" \ [list [list ld $abi_ldflags(n32)]] + run_dump_test "mips16-branch-absolute-n32-1" \ + [list [list ld $abi_ldflags(n32)]] + run_dump_test "mips16-branch-absolute-n32-2" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "mips16-branch-absolute-addend-n32" \ [list [list ld $abi_ldflags(n32)]] + run_dump_test "mips16-branch-absolute-addend-n32-1" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "mips16-branch-absolute-n64" \ [list [list ld $abi_ldflags(n64)]] + run_dump_test "mips16-branch-absolute-n64-1" \ + [list [list ld $abi_ldflags(n64)]] + run_dump_test "mips16-branch-absolute-n64-2" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "mips16-branch-absolute-addend-n64" \ [list [list ld $abi_ldflags(n64)]] + run_dump_test "mips16-branch-absolute-addend-n64-1" \ + [list [list ld $abi_ldflags(n64)]] } run_dump_test "micromips-branch-absolute" [list [list ld $abi_ldflags(o32)]] diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-1.d new file mode 100644 index 00000000000..9e0aa5f44ed --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 1 +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-1.s +#as: -EB -32 +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-2.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-2.d new file mode 100644 index 00000000000..5e7e6f9905d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-2.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 2 +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-2.s +#as: -EB -32 +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d new file mode 100644 index 00000000000..40f6ccbb961 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression with addend 1 +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s +#as: -EB -32 +#ld: -EB -Ttext 0x12340000 -e foo +#dump: mips16-branch-absolute-addend.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d new file mode 100644 index 00000000000..8e833d8d0dc --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression with addend 1 (n32) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x12340000 -e foo +#dump: mips16-branch-absolute-addend.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d new file mode 100644 index 00000000000..094b2d0515d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression with addend 1 (n64) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-addend-1.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x12340000 -e foo +#dump: mips16-branch-absolute-addend.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d new file mode 100644 index 00000000000..587e79a03ae --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 1 (n32) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-1.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d new file mode 100644 index 00000000000..86c98c3c2d5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 2 (n32) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-2.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d new file mode 100644 index 00000000000..dc067f82cb0 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 1 (n64) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-1.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d diff --git a/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d new file mode 100644 index 00000000000..1a6ba3d32ad --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d @@ -0,0 +1,6 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS16 link branch to absolute expression 2 (n64) +#source: ../../../gas/testsuite/gas/mips/mips16-branch-absolute-2.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0 -e foo +#dump: mips16-branch-absolute.d -- 2.30.2