+2017-08-30 Maciej W. Rozycki <macro@imgtec.com>
+
+ * config/tc-mips.c (md_convert_frag): Respect
+ `mips_ignore_branch_isa'.
+ * testsuite/gas/mips/branch-local-5.d: New test.
+ * testsuite/gas/mips/branch-local-n32-5.d: New test.
+ * testsuite/gas/mips/branch-local-n64-5.d: New test.
+ * testsuite/gas/mips/branch-local-6.d: New test.
+ * testsuite/gas/mips/branch-local-n32-6.d: New test.
+ * testsuite/gas/mips/branch-local-n64-6.d: New test.
+ * testsuite/gas/mips/branch-local-7.d: New test.
+ * testsuite/gas/mips/branch-local-n32-7.d: New test.
+ * testsuite/gas/mips/branch-local-n64-7.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-5.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n32-5.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n64-5.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-6.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n32-6.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n64-6.d: New test.
+ * testsuite/gas/mips/branch-local-5.l: New stderr output.
+ * testsuite/gas/mips/branch-local-6.l: New stderr output.
+ * testsuite/gas/mips/branch-local-5.s: New test source.
+ * testsuite/gas/mips/branch-local-6.s: New test source.
+ * testsuite/gas/mips/branch-local-7.s: New test source.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+
2017-08-30 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/gas/mips/branch-local-n32-2.d: Use `branch-local-2.l'
if (pcrel_op->include_isa_bit && !need_reloc)
{
- if (!ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol)))
+ if (!mips_ignore_branch_isa
+ && !ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol)))
as_bad_where (fragp->fr_file, fragp->fr_line,
_("branch to a symbol in another ISA mode"));
else if ((fragp->fr_offset & 0x1) != 0)
--- /dev/null
+#name: MIPS branch local symbol relocation 5
+#as: -32
+#error-output: branch-local-5.l
--- /dev/null
+.*: Assembler messages:
+.*:19: Error: branch to a symbol in another ISA mode
+.*:21: Error: branch to a symbol in another ISA mode
+.*:23: Error: branch to a symbol in another ISA mode
--- /dev/null
+ .text
+ .set noreorder
+ .space 0x1000
+
+ .align 4
+ .set nomips16
+ .ent foo
+foo:
+ nor $0, $0
+ jalr $0, $ra
+ nor $0, $0
+ .end foo
+
+ .align 4
+ .set mips16
+ .ent bar
+bar:
+ not $16, $16
+ b foo
+ not $16, $16
+ beqz $2, foo
+ not $16, $16
+ bteqz foo
+ not $16, $16
+ jr $ra
+ not $16, $16
+ .end bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
--- /dev/null
+#name: MIPS branch local symbol relocation 6
+#as: -32
+#error-output: branch-local-6.l
--- /dev/null
+.*: Assembler messages:
+.*:19: Error: branch to a symbol in another ISA mode
+.*:25: Error: branch to a symbol in another ISA mode
+.*:27: Error: branch to a symbol in another ISA mode
+.*:29: Error: branch to a symbol in another ISA mode
+.*:31: Error: branch to a symbol in another ISA mode
+.*:33: Error: branch to a symbol in another ISA mode
+.*:21: Error: branch to a symbol in another ISA mode
+.*:23: Error: branch to a symbol in another ISA mode
--- /dev/null
+ .text
+ .set noreorder
+ .space 0x1000
+
+ .align 4
+ .set nomicromips
+ .ent foo
+foo:
+ nor $0, $0
+ jalr $0, $ra
+ nor $0, $0
+ .end foo
+
+ .align 4
+ .set micromips
+ .ent bar
+bar:
+ nor $0, $0
+ beqzc $2, foo
+ nor $0, $0
+ b foo
+ nor $0, $0
+ beqz $2, foo
+ nor $0, $0
+ bgezal $2, foo
+ nor $0, $0
+ bgezals $2, foo
+ not $16, $16
+ bltzal $2, foo
+ nor $0, $0
+ bltzals $2, foo
+ not $16, $16
+ bals foo
+ not $16, $16
+ jalr $0, $ra
+ nor $0, $0
+ .end bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 7
+#as: -32
+#source: branch-local-7.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4060 fffe bal 00001014 <bar\+0x4>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
--- /dev/null
+ .text
+ .set noreorder
+ .space 0x1000
+
+ .align 4
+ .set nomicromips
+ .ent foo
+foo:
+ nor $0, $0
+ jalr $0, $ra
+ nor $0, $0
+ .end foo
+
+ .align 4
+ .set micromips
+ .ent bar
+bar:
+ nor $0, $0
+ bal foo
+ nor $0, $0
+ jalr $0, $ra
+ nor $0, $0
+ .end bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 5 (ignore branch ISA)
+#as: -32 -mignore-branch-isa
+#source: branch-local-5.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> e80f not s0
+[0-9a-f]+ <[^>]*> 17f6 b 0+001000 <foo>
+[0-9a-f]+ <[^>]*> e80f not s0
+[0-9a-f]+ <[^>]*> 22f4 beqz v0,0+001000 <foo>
+[0-9a-f]+ <[^>]*> e80f not s0
+[0-9a-f]+ <[^>]*> 60f2 bteqz 0+001000 <foo>
+[0-9a-f]+ <[^>]*> e80f not s0
+[0-9a-f]+ <[^>]*> e820 jr ra
+[0-9a-f]+ <[^>]*> e80f not s0
+ \.\.\.
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 6 (ignore branch ISA)
+#as: -32 -mignore-branch-isa
+#source: branch-local-6.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 40e2 fffe beqzc v0,00001014 <bar\+0x4>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> cfff b 0000101c <bar\+0xc>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 8d7f beqz v0,00001022 <bar\+0x12>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4062 fffe bgezal v0,00001028 <bar\+0x18>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4262 fffe bgezals v0,00001030 <bar\+0x20>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4022 fffe bltzal v0,00001036 <bar\+0x26>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4222 fffe bltzals v0,0000103e <bar\+0x2e>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4260 fffe bals 00001044 <bar\+0x34>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 5 (ignore branch ISA, n32)
+#as: -n32 -march=from-abi -mignore-branch-isa
+#source: branch-local-5.s
+#dump: branch-local-ignore-5.d
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 6 (ignore branch ISA, n32)
+#as: -n32 -march=from-abi -mignore-branch-isa
+#source: branch-local-6.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 40e2 0000 beqzc v0,00001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> cc00 b 0000101e <bar\+0xe>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 \.text\+0xffe
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 8d00 beqz v0,00001024 <bar\+0x14>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 \.text\+0xffe
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4062 0000 bgezal v0,0000102c <bar\+0x1c>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4262 0000 bgezals v0,00001034 <bar\+0x24>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4022 0000 bltzal v0,0000103a <bar\+0x2a>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4222 0000 bltzals v0,00001042 <bar\+0x32>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4260 0000 bals 00001048 <bar\+0x38>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 5 (ignore branch ISA, n64)
+#as: -64 -march=from-abi -mignore-branch-isa
+#source: branch-local-5.s
+#dump: branch-local-ignore-5.d
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 6 (ignore branch ISA, n64)
+#as: -64 -march=from-abi -mignore-branch-isa
+#source: branch-local-6.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 40e2 0000 beqzc v0,0000000000001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> cc00 b 000000000000101e <bar\+0xe>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 \.text\+0xffe
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 8d00 beqz v0,0000000000001024 <bar\+0x14>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 \.text\+0xffe
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4062 0000 bgezal v0,000000000000102c <bar\+0x1c>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4262 0000 bgezals v0,0000000000001034 <bar\+0x24>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4022 0000 bltzal v0,000000000000103a <bar\+0x2a>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4222 0000 bltzals v0,0000000000001042 <bar\+0x32>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 4260 0000 bals 0000000000001048 <bar\+0x38>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 4400 not s0,s0
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
--- /dev/null
+#name: MIPS branch local symbol relocation 5 (n32)
+#as: -n32 -march=from-abi
+#error-output: branch-local-5.l
+#source: branch-local-5.s
--- /dev/null
+#name: MIPS branch local symbol relocation 6 (n32)
+#as: -n32 -march=from-abi
+#error-output: branch-local-6.l
+#source: branch-local-6.s
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 7 (n32)
+#as: -n32 -march=from-abi
+#source: branch-local-7.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 bal 00001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
--- /dev/null
+#name: MIPS branch local symbol relocation 5 (n64)
+#as: -64 -march=from-abi
+#error-output: branch-local-5.l
+#source: branch-local-5.s
--- /dev/null
+#name: MIPS branch local symbol relocation 6 (n64)
+#as: -64 -march=from-abi
+#error-output: branch-local-6.l
+#source: branch-local-6.s
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 7 (n64)
+#as: -64 -march=from-abi
+#source: branch-local-7.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+ \.\.\.
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 4060 0000 bal 0000000000001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+[0-9a-f]+ <[^>]*> 001f 0f3c jr ra
+[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero
+ \.\.\.
run_dump_test "branch-local-3"
run_dump_test "branch-local-ignore-3"
run_dump_test "branch-local-4"
+ run_dump_test "branch-local-5"
+ run_dump_test "branch-local-ignore-5"
+ run_dump_test "branch-local-6"
+ run_dump_test "branch-local-ignore-6"
+ run_dump_test "branch-local-7"
if $has_newabi {
run_dump_test "branch-local-n32-1"
run_dump_test "branch-local-n32-2"
run_dump_test "branch-local-n32-3"
run_dump_test "branch-local-ignore-n32-3"
run_dump_test "branch-local-n32-4"
+ run_dump_test "branch-local-n32-5"
+ run_dump_test "branch-local-ignore-n32-5"
+ run_dump_test "branch-local-n32-6"
+ run_dump_test "branch-local-ignore-n32-6"
+ run_dump_test "branch-local-n32-7"
run_dump_test "branch-local-n64-1"
run_dump_test "branch-local-n64-2"
run_dump_test "branch-local-ignore-n64-2"
run_dump_test "branch-local-n64-3"
run_dump_test "branch-local-ignore-n64-3"
run_dump_test "branch-local-n64-4"
+ run_dump_test "branch-local-n64-5"
+ run_dump_test "branch-local-ignore-n64-5"
+ run_dump_test "branch-local-n64-6"
+ run_dump_test "branch-local-ignore-n64-6"
+ run_dump_test "branch-local-n64-7"
}
run_dump_test "branch-addend"
if $has_newabi {