aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-05-03 00:05:15 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2017-05-03 00:15:56 +0100
commit82d808edbc7a06f706b82064cec6c3ed88f0c4be (patch)
tree6510e8c35632eba734ed8508067ca9f98f625fc8 /ld/testsuite
parent3d8505928a06e00b05bb162c1ad0dd612c1c16af (diff)
downloadgdb-82d808edbc7a06f706b82064cec6c3ed88f0c4be.zip
gdb-82d808edbc7a06f706b82064cec6c3ed88f0c4be.tar.gz
gdb-82d808edbc7a06f706b82064cec6c3ed88f0c4be.tar.bz2
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.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp16
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-2.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d6
10 files changed, 70 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index f824e7c..068ea54 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 0000000..9e0aa5f
--- /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 0000000..5e7e6f9
--- /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 0000000..40f6ccb
--- /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 0000000..8e833d8
--- /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 0000000..094b2d0
--- /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 0000000..587e79a
--- /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 0000000..86c98c3
--- /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 0000000..dc067f8
--- /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 0000000..1a6ba3d
--- /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