aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-07-19 16:19:19 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-07-19 16:22:53 +0100
commita6ebf6169a1bd14724b9ac49990089542396f576 (patch)
tree4b6f6a0e2fe8f81127178b480df5c7c9591eb8bd /ld/testsuite/ld-mips-elf
parent9d862524f6ae9703fe8e264dd4785756d358570a (diff)
downloadgdb-a6ebf6169a1bd14724b9ac49990089542396f576.zip
gdb-a6ebf6169a1bd14724b9ac49990089542396f576.tar.gz
gdb-a6ebf6169a1bd14724b9ac49990089542396f576.tar.bz2
MIPS: Convert cross-mode BAL to JALX
Convert cross-mode regular MIPS and microMIPS BAL instructions to JALX, similarly to how JAL instructions are converted. bfd/ * elfxx-mips.c (mips_elf_perform_relocation): Convert cross-mode BAL to JALX. (_bfd_mips_elf_relocate_section) <bfd_reloc_outofrange>: Add a corresponding error message. gas/ * config/tc-mips.c (mips_force_relocation, mips_fix_adjustable): Adjust comments for BAL to JALX linker conversion. (fix_bad_cross_mode_branch_p): Accept cross-mode BAL. * testsuite/gas/mips/unaligned-branch-1.l: Update error messages expected. * testsuite/gas/mips/unaligned-branch-micromips-1.l: Likewise. * testsuite/gas/mips/branch-local-4.d: New test. * testsuite/gas/mips/branch-local-n32-4.d: New test. * testsuite/gas/mips/branch-local-n64-4.d: New test. * testsuite/gas/mips/branch-addend.d: New test. * testsuite/gas/mips/branch-addend-n32.d: New test. * testsuite/gas/mips/branch-addend-n64.d: New test. * testsuite/gas/mips/branch-local-4.s: New test source. * testsuite/gas/mips/branch-addend.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/unaligned-branch-2.d: Update error messages expected. * testsuite/ld-mips-elf/unaligned-branch-r6-1.d: Likewise. * testsuite/ld-mips-elf/unaligned-branch-mips16.d: Likewise. * testsuite/ld-mips-elf/unaligned-branch-micromips.d: Likewise. * testsuite/ld-mips-elf/bal-jalx-addend.d: New test. * testsuite/ld-mips-elf/bal-jalx-local.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic.d: New test. * testsuite/ld-mips-elf/bal-jalx-addend-n32.d: New test. * testsuite/ld-mips-elf/bal-jalx-local-n32.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-n32.d: New test. * testsuite/ld-mips-elf/bal-jalx-addend-n64.d: New test. * testsuite/ld-mips-elf/bal-jalx-local-n64.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-n64.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-2.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-3.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-2.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-addend-3.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-2.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-3.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-addend-2.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-addend-3.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'ld/testsuite/ld-mips-elf')
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-addend-n32.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-addend-n64.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-addend.d22
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-local-n32.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-local-n64.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-local.d20
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-pic-n32.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-pic-n64.d6
-rw-r--r--ld/testsuite/ld-mips-elf/bal-jalx-pic.d6
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp15
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-branch-2.d38
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-branch-micromips.d78
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-branch-mips16.d24
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-branch-r6-1.d32
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-2.d7
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-2.s12
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-3.d7
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-3.s11
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.d7
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.s14
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.d29
-rw-r--r--ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.s22
22 files changed, 278 insertions, 102 deletions
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-n32.d
new file mode 100644
index 0000000..a425eff
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-n32.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL/JALX addend calculation (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-addend.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-n64.d
new file mode 100644
index 0000000..0b7a013
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-n64.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL/JALX addend calculation (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-addend.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend.d
new file mode 100644
index 0000000..91012f9
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend.d
@@ -0,0 +1,22 @@
+#name: MIPS BAL/JALX addend calculation
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 0000 0000 nop
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 77008400 jalx 0*1c021000 <.*>
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 04117ffc bal 0*1c021010 <.*>
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+ \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-n32.d
new file mode 100644
index 0000000..adaa798
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-n32.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL to JALX conversion for local symbol (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-local-4.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-local.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-n64.d
new file mode 100644
index 0000000..e94f290
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-n64.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL to JALX conversion for local symbol (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-local-4.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: bal-jalx-local.d
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local.d b/ld/testsuite/ld-mips-elf/bal-jalx-local.d
new file mode 100644
index 0000000..599cf26
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-local.d
@@ -0,0 +1,20 @@
+#name: MIPS BAL to JALX conversion for local symbol
+#source: ../../../gas/testsuite/gas/mips/branch-local-4.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 0000 0000 nop
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 77000400 jalx 0*1c001000 <foo>
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+ \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-n32.d
new file mode 100644
index 0000000..39d5a38
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-n32.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL/JALX in PIC mode (n32)
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-n64.d
new file mode 100644
index 0000000..2a09149
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-n64.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL/JALX in PIC mode (n64)
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -64 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic.d
new file mode 100644
index 0000000..daf6211
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic.d
@@ -0,0 +1,6 @@
+#name: MIPS BAL/JALX in PIC mode
+#source: ../../../gas/testsuite/gas/mips/branch-addend.s
+#as: -EB -32
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared
+#error: \A[^\n]*: In function `bar':\n
+#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 6a78fd8..10a4339 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -213,15 +213,26 @@ if { $linux_gnu } {
run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]]
run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-addend" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-local" [list [list ld $abi_ldflags(o32)]]
+run_dump_test "bal-jalx-pic" [list [list ld $abi_ldflags(o32)]]
if $has_newabi {
run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]]
run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]]
+ run_dump_test "bal-jalx-addend-n32" [list [list ld $abi_ldflags(n32)]]
+ run_dump_test "bal-jalx-local-n32" [list [list ld $abi_ldflags(n32)]]
+ run_dump_test "bal-jalx-pic-n32" [list [list ld $abi_ldflags(n32)]]
run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]]
run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]]
+ run_dump_test "bal-jalx-addend-n64" [list [list ld $abi_ldflags(n64)]]
+ run_dump_test "bal-jalx-local-n64" [list [list ld $abi_ldflags(n64)]]
+ run_dump_test "bal-jalx-pic-n64" [list [list ld $abi_ldflags(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)]]
@@ -232,6 +243,10 @@ if $has_newabi {
[list [list ld $abi_ldflags(n32)]]
run_dump_test "unaligned-jalx-addend-1" \
[list [list ld $abi_ldflags(n32)]]
+ run_dump_test "unaligned-jalx-addend-2" \
+ [list [list ld $abi_ldflags(n32)]]
+ run_dump_test "unaligned-jalx-addend-3" \
+ [list [list ld $abi_ldflags(n32)]]
run_dump_test "unaligned-jalx-addend-mips16-0" \
[list [list ld $abi_ldflags(n32)]]
run_dump_test "unaligned-jalx-addend-mips16-1" \
diff --git a/ld/testsuite/ld-mips-elf/unaligned-branch-2.d b/ld/testsuite/ld-mips-elf/unaligned-branch-2.d
index 60755cb..2be87a8 100644
--- a/ld/testsuite/ld-mips-elf/unaligned-branch-2.d
+++ b/ld/testsuite/ld-mips-elf/unaligned-branch-2.d
@@ -39,68 +39,54 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10bc\): Branch to a non-instruction-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10dc\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10e4\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10ec\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10f4\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10f4\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x10f4\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10fc\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10fc\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10fc\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1104\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1104\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1104\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x110c\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1114\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x111c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1124\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1124\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x1124\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x112c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x112c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x112c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1134\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1134\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1134\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x113c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x113c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x113c\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1144\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1144\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1144\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x114c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x114c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x114c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1154\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1154\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x1154\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x115c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x115c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x115c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1164\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1164\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1164\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x116c\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1174\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x117c\): Unsupported branch between ISA modes\Z
diff --git a/ld/testsuite/ld-mips-elf/unaligned-branch-micromips.d b/ld/testsuite/ld-mips-elf/unaligned-branch-micromips.d
index e32a187..cd485fc 100644
--- a/ld/testsuite/ld-mips-elf/unaligned-branch-micromips.d
+++ b/ld/testsuite/ld-mips-elf/unaligned-branch-micromips.d
@@ -3,35 +3,17 @@
#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
#source: ../../../gas/testsuite/gas/mips/unaligned-branch-micromips-2.s
#error: \A[^\n]*: In function `foo':\n
-#error: \(\.text\+0x1002\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x100a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x100a\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1012\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x100a\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x101a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1012\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x102a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1012\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x1032\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x101a\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x101a\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1022\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x102a\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x102a\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1032\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1032\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x103a\): Branch to a non-instruction-aligned address\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x103a\): Unsupported branch between ISA modes\n
-#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1042\): Unsupported branch between ISA modes\n
+#error: \(\.text\+0x103a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1062\): Branch to a non-instruction-aligned address\n
#error: [^\n]*: In function `foo':\n
@@ -39,29 +21,29 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1082\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1088\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1088\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1088\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x108e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x108e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x108e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1094\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1094\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1094\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x109a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10a0\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10a0\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10a0\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10a6\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10a6\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10a6\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10ac\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10ac\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10ac\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
@@ -73,29 +55,29 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10e2\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10e8\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10e8\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10e8\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10ee\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10ee\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10ee\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10f4\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10f4\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10f4\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10fa\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1100\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1100\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1100\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1106\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1106\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1106\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x110c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x110c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x110c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
@@ -107,29 +89,29 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1142\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1146\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1146\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1146\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x114a\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x114a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x114a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x114e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x114e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x114e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1152\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1156\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1156\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1156\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x115a\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x115a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x115a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x115e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x115e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x115e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
@@ -141,29 +123,29 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1182\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1186\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1186\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1186\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x118a\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x118a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x118a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x118e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x118e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x118e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1192\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1196\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1196\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1196\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x119a\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x119a\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x119a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x119e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x119e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x119e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
diff --git a/ld/testsuite/ld-mips-elf/unaligned-branch-mips16.d b/ld/testsuite/ld-mips-elf/unaligned-branch-mips16.d
index 1752683..399a457 100644
--- a/ld/testsuite/ld-mips-elf/unaligned-branch-mips16.d
+++ b/ld/testsuite/ld-mips-elf/unaligned-branch-mips16.d
@@ -5,29 +5,29 @@
#error: \A[^\n]*: In function `foo':\n
#error: \(\.text\+0x1002\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1008\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1008\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1008\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x100e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x100e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x100e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1014\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1014\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x101a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1020\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1020\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1020\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1026\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1026\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1026\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x102c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x102c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x102c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
@@ -39,29 +39,29 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1062\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1068\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1068\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1068\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x106e\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x106e\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x106e\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1074\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1074\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1074\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x107a\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1080\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1080\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1080\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1086\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1086\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1086\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x108c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x108c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x108c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
diff --git a/ld/testsuite/ld-mips-elf/unaligned-branch-r6-1.d b/ld/testsuite/ld-mips-elf/unaligned-branch-r6-1.d
index 070304e..c63fa5f 100644
--- a/ld/testsuite/ld-mips-elf/unaligned-branch-r6-1.d
+++ b/ld/testsuite/ld-mips-elf/unaligned-branch-r6-1.d
@@ -39,59 +39,59 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10bc\): Branch to a non-instruction-aligned address\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10dc\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10dc\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10dc\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10e4\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10e4\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10e4\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10ec\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10f4\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10f4\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10f4\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x10fc\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x10fc\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x10fc\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1104\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1104\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1104\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x110c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x110c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x110c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1114\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1114\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1114\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x111c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1124\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1124\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1124\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x112c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x112c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x112c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1134\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1134\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1134\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x113c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x113c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x113c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1144\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1144\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1144\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x114c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x114c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x114c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
@@ -99,15 +99,15 @@
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x115c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1164\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1164\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1164\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x116c\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x116c\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x116c\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
-#error: \(\.text\+0x1174\): Branch to a non-instruction-aligned address\n
+#error: \(\.text\+0x1174\): Cannot convert a branch to JALX for a non-word-aligned address\n
#error: [^\n]*: In function `foo':\n
#error: \(\.text\+0x1174\): Unsupported branch between ISA modes\n
#error: [^\n]*: In function `foo':\n
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d
new file mode 100644
index 0000000..718c53d
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.d
@@ -0,0 +1,7 @@
+#name: MIPS JALX to unaligned symbol 2
+#source: unaligned-jalx-2.s
+#source: unaligned-insn.s -mips16
+#as: -EB -32
+#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-2.s b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.s
new file mode 100644
index 0000000..128f24d
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-2.s
@@ -0,0 +1,12 @@
+ .text
+ .align 4
+ .globl foo
+ .ent foo
+foo:
+ bal bar0
+ bal bar2
+ .end foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d
new file mode 100644
index 0000000..d64e42f
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.d
@@ -0,0 +1,7 @@
+#name: MIPS JALX to unaligned symbol 3
+#source: unaligned-jalx-3.s
+#source: unaligned-insn.s -mips16
+#as: -EB -32
+#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-3.s b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.s
new file mode 100644
index 0000000..001d782
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-3.s
@@ -0,0 +1,11 @@
+ .text
+ .align 4
+ .globl foo
+ .ent foo
+foo:
+ bal bar1
+ .end foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.d
new file mode 100644
index 0000000..f09ce28
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.d
@@ -0,0 +1,7 @@
+#name: MIPS JALX to unaligned symbol with addend 2
+#source: unaligned-jalx-addend-2.s
+#source: unaligned-insn.s -mips16
+#as: -EB -n32 -march=from-abi
+#ld: -EB -Ttext 0x1c000000 -e 0x1c000000
+#objdump: -dr --prefix-addresses --show-raw-insn
+#dump: unaligned-jalx-addend-0.d
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.s b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.s
new file mode 100644
index 0000000..e68573d
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-2.s
@@ -0,0 +1,14 @@
+ .text
+ .align 4
+ .globl foo
+ .ent foo
+foo:
+ bal bar0 + 4
+ bal bar1 - 2
+ bal bar2 - 4
+ bal bar3 + 2
+ .end foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.d b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.d
new file mode 100644
index 0000000..1c0551c
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.d
@@ -0,0 +1,29 @@
+#name: MIPS JALX to unaligned symbol with addend 3
+#source: unaligned-jalx-addend-3.s
+#source: unaligned-insn.s -mips16
+#as: -EB -n32 -march=from-abi
+#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\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x8\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x10\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x18\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x20\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x28\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x30\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x38\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x40\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x48\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x50\): Cannot convert a branch to JALX for a non-word-aligned address\n
+#error: [^\n]*: In function `foo':\n
+#error: \(\.text\+0x58\): Cannot convert a branch to JALX for a non-word-aligned address\Z
diff --git a/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.s b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.s
new file mode 100644
index 0000000..8628631
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/unaligned-jalx-addend-3.s
@@ -0,0 +1,22 @@
+ .text
+ .align 4
+ .globl foo
+ .ent foo
+foo:
+ bal bar0 + 1
+ bal bar0 + 2
+ bal bar0 + 3
+ bal bar1 + 1
+ bal bar1 + 3
+ bal bar1 + 4
+ bal bar2 - 1
+ bal bar2 - 2
+ bal bar2 - 3
+ bal bar3 - 1
+ bal bar3 - 3
+ bal bar3 - 4
+ .end foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16