aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-01-30 17:11:22 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2017-01-30 17:16:01 +0000
commit8b10b0b3e100c25322a083248c7a18bf5a1f3527 (patch)
tree4993513d1cb11f9a039d4c01b7373a9afcb13616 /gas
parent7795a8f8bdde2fa5c0e0639b92280314b32ec78d (diff)
downloadgdb-8b10b0b3e100c25322a083248c7a18bf5a1f3527.zip
gdb-8b10b0b3e100c25322a083248c7a18bf5a1f3527.tar.gz
gdb-8b10b0b3e100c25322a083248c7a18bf5a1f3527.tar.bz2
MIPS: Add options to control branch ISA checks
Complement commit 9d862524f6ae ("MIPS: Verify the ISA mode and alignment of branch and jump targets") and add GAS and LD options to control the checks for invalid branches between ISA modes introduced there, to help with some handwritten code lacking `.insn' annotation for labels used as branch targets and code produced by older versions of GCC which suffers from the issue with branches to code that has been optimized away, addressed with GCC commit 242424 ("MIPS/GCC: Mark trailing labels with `.insn'"), <https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01061.html>. bfd/ * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to... (_bfd_mips_elf_linker_flags): ... this. Add another parameter. * elfxx-mips.c (mips_elf_link_hash_table): Add `ignore_branch_isa' member. (mips_elf_perform_relocation): Do not treat an ISA mode mismatch in branch relocation calculation as an error if `ignore_branch_isa' has been set. (_bfd_mips_elf_insn32): Rename to... (_bfd_mips_elf_linker_flags): ... this. Rename the `on' parameter to `insn32' and add an `ignore_branch_isa' parameter. Handle the new parameter. gas/ * config/tc-mips.c (mips_ignore_branch_isa): New variable. (options): Add OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA enum values. (md_longopts): Add "mignore-branch-isa" and "mno-ignore-branch-isa" options. (md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA. (fix_bad_cross_mode_branch_p): Return FALSE if `mips_ignore_branch_isa' has been set. (md_show_usage): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa'. * doc/as.texinfo (Target MIPS options): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa' options. (-mignore-branch-isa, -mno-ignore-branch-isa): New options. * doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa' options. * testsuite/gas/mips/branch-local-ignore-2.d: New test. * testsuite/gas/mips/branch-local-ignore-3.d: New test. * testsuite/gas/mips/branch-local-ignore-n32-2.d: New test. * testsuite/gas/mips/branch-local-ignore-n32-3.d: New test. * testsuite/gas/mips/branch-local-ignore-n64-2.d: New test. * testsuite/gas/mips/branch-local-ignore-n64-3.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * emultempl/mipself.em (ignore_branch_isa): New variable. (mips_create_output_section_statements): Rename `_bfd_mips_elf_insn32' called to `_bfd_mips_elf_linker_flags', add `ignore_branch_isa' argument. (PARSE_AND_LIST_PROLOGUE): Add OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA enum values. (PARSE_AND_LIST_LONGOPTS): Add "ignore-branch-isa" and "no-ignore-branch-isa" options. (PARSE_AND_LIST_OPTIONS): Add `--ignore-branch-isa' and `--no-ignore-branch-isa'. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA. * ld.texinfo (Options specific to MIPS targets): Add `--ignore-branch-isa' and `--no-ignore-branch-isa' options. (ld and the MIPS family): Likewise. * testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-mips16: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-micromips: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog28
-rw-r--r--gas/config/tc-mips.c22
-rw-r--r--gas/doc/as.texinfo12
-rw-r--r--gas/doc/c-mips.texi31
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-2.d29
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-3.d23
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-n32-2.d29
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-n32-3.d23
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-n64-2.d37
-rw-r--r--gas/testsuite/gas/mips/branch-local-ignore-n64-3.d27
-rw-r--r--gas/testsuite/gas/mips/mips.exp6
11 files changed, 267 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0f3c73b..69d7c13 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,33 @@
2017-01-30 Maciej W. Rozycki <macro@imgtec.com>
+ * config/tc-mips.c (mips_ignore_branch_isa): New variable.
+ (options): Add OPTION_IGNORE_BRANCH_ISA and
+ OPTION_NO_IGNORE_BRANCH_ISA enum values.
+ (md_longopts): Add "mignore-branch-isa" and
+ "mno-ignore-branch-isa" options.
+ (md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and
+ OPTION_NO_IGNORE_BRANCH_ISA.
+ (fix_bad_cross_mode_branch_p): Return FALSE if
+ `mips_ignore_branch_isa' has been set.
+ (md_show_usage): Add `-mignore-branch-isa' and
+ `-mno-ignore-branch-isa'.
+
+ * doc/as.texinfo (Target MIPS options): Add
+ `-mignore-branch-isa' and `-mno-ignore-branch-isa' options.
+ (-mignore-branch-isa, -mno-ignore-branch-isa): New options.
+ * doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and
+ `-mno-ignore-branch-isa' options.
+
+ * testsuite/gas/mips/branch-local-ignore-2.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-3.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n32-2.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n32-3.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n64-2.d: New test.
+ * testsuite/gas/mips/branch-local-ignore-n64-3.d: New test.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+
+2017-01-30 Maciej W. Rozycki <macro@imgtec.com>
+
* testsuite/gas/mips/branch-local-2.d: New test.
* testsuite/gas/mips/branch-local-3.d: New test.
* testsuite/gas/mips/branch-local-n32-2.d: New test.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 02a4e22..d151b01 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -943,6 +943,11 @@ static bfd_boolean mips_fix_cn63xxp1;
efficient expansion. */
static int mips_relax_branch;
+
+/* TRUE if checks are suppressed for invalid branches between ISA modes.
+ Needed for broken assembly produced by some GCC versions and some
+ sloppy code out there, where branches to data labels are present. */
+static bfd_boolean mips_ignore_branch_isa;
/* The expansion of many macros depends on the type of symbol that
they refer to. For example, when generating position-dependent code,
@@ -1465,6 +1470,8 @@ enum options
OPTION_GP64,
OPTION_RELAX_BRANCH,
OPTION_NO_RELAX_BRANCH,
+ OPTION_IGNORE_BRANCH_ISA,
+ OPTION_NO_IGNORE_BRANCH_ISA,
OPTION_INSN32,
OPTION_NO_INSN32,
OPTION_MSHARED,
@@ -1591,6 +1598,8 @@ struct option md_longopts[] =
{"mgp64", no_argument, NULL, OPTION_GP64},
{"relax-branch", no_argument, NULL, OPTION_RELAX_BRANCH},
{"no-relax-branch", no_argument, NULL, OPTION_NO_RELAX_BRANCH},
+ {"mignore-branch-isa", no_argument, NULL, OPTION_IGNORE_BRANCH_ISA},
+ {"mno-ignore-branch-isa", no_argument, NULL, OPTION_NO_IGNORE_BRANCH_ISA},
{"minsn32", no_argument, NULL, OPTION_INSN32},
{"mno-insn32", no_argument, NULL, OPTION_NO_INSN32},
{"mshared", no_argument, NULL, OPTION_MSHARED},
@@ -14499,6 +14508,14 @@ md_parse_option (int c, const char *arg)
mips_relax_branch = 0;
break;
+ case OPTION_IGNORE_BRANCH_ISA:
+ mips_ignore_branch_isa = TRUE;
+ break;
+
+ case OPTION_NO_IGNORE_BRANCH_ISA:
+ mips_ignore_branch_isa = FALSE;
+ break;
+
case OPTION_INSN32:
file_mips_opts.insn32 = TRUE;
break;
@@ -15133,6 +15150,9 @@ fix_bad_cross_mode_branch_p (fixS *fixP)
int other;
char *buf;
+ if (mips_ignore_branch_isa)
+ return FALSE;
+
if (!fixP->fx_addsy || S_FORCE_RELOC (fixP->fx_addsy, TRUE))
return FALSE;
@@ -19662,6 +19682,8 @@ MIPS options:\n\
-mdouble-float allow 32-bit and 64-bit floating-point operations\n\
--[no-]construct-floats [dis]allow floating point values to be constructed\n\
--[no-]relax-branch [dis]allow out-of-range branches to be relaxed\n\
+-mignore-branch-isa accept invalid branches requiring an ISA mode switch\n\
+-mno-ignore-branch-isa reject invalid branches requiring an ISA mode switch\n\
-mnan=ENCODING select an IEEE 754 NaN encoding convention, either of:\n"));
first = 1;
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index 5e30fc4..007332e 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -416,6 +416,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@b{-mips32r3}] [@b{-mips32r5}] [@b{-mips32r6}] [@b{-mips64}] [@b{-mips64r2}]
[@b{-mips64r3}] [@b{-mips64r5}] [@b{-mips64r6}]
[@b{-construct-floats}] [@b{-no-construct-floats}]
+ [@b{-mignore-branch-isa}] [@b{-mno-ignore-branch-isa}]
[@b{-mnan=@var{encoding}}]
[@b{-trap}] [@b{-no-break}] [@b{-break}] [@b{-no-trap}]
[@b{-mips16}] [@b{-no-mips16}]
@@ -1546,6 +1547,17 @@ The @samp{--relax-branch} option enables the relaxation of out-of-range
branches. By default @samp{--no-relax-branch} is selected, causing any
out-of-range branches to produce an error.
+@item -mignore-branch-isa
+@itemx -mno-ignore-branch-isa
+Ignore branch checks for invalid transitions between ISA modes. The
+semantics of branches does not provide for an ISA mode switch, so in
+most cases the ISA mode a branch has been encoded for has to be the
+same as the ISA mode of the branch's target label. Therefore GAS has
+checks implemented that verify in branch assembly that the two ISA
+modes match. @samp{-mignore-branch-isa} disables these checks. By
+default @samp{-mno-ignore-branch-isa} is selected, causing any invalid
+branch requiring a transition between ISA modes to produce an error.
+
@item -mnan=@var{encoding}
Select between the IEEE 754-2008 (@option{-mnan=2008}) or the legacy
(@option{-mnan=legacy}) NaN encoding format. The latter is the default.
diff --git a/gas/doc/c-mips.texi b/gas/doc/c-mips.texi
index 04666f4..d9a09f1 100644
--- a/gas/doc/c-mips.texi
+++ b/gas/doc/c-mips.texi
@@ -472,6 +472,37 @@ Also no MIPS16 branches are ever relaxed.
By default @samp{--no-relax-branch} is selected, causing any out-of-range
branches to produce an error.
+@item -mignore-branch-isa
+@itemx -mno-ignore-branch-isa
+Ignore branch checks for invalid transitions between ISA modes.
+
+The semantics of branches does not provide for an ISA mode switch, so in
+most cases the ISA mode a branch has been encoded for has to be the same
+as the ISA mode of the branch's target label. If the ISA modes do not
+match, then such a branch, if taken, will cause the ISA mode to remain
+unchanged and instructions that follow will be executed in the wrong ISA
+mode causing the program to misbehave or crash.
+
+In the case of the @code{BAL} instruction it may be possible to relax
+it to an equivalent @code{JALX} instruction so that the ISA mode is
+switched at the run time as required. For other branches no relaxation
+is possible and therefore GAS has checks implemented that verify in
+branch assembly that the two ISA modes match, and report an error
+otherwise so that the problem with code can be diagnosed at the assembly
+time rather than at the run time.
+
+However some assembly code, including generated code produced by some
+versions of GCC, may incorrectly include branches to data labels, which
+appear to require a mode switch but are either dead or immediately
+followed by valid instructions encoded for the same ISA the branch has
+been encoded for. While not strictly correct at the source level such
+code will execute as intended, so to help with these cases
+@samp{-mignore-branch-isa} is supported which disables ISA mode checks
+for branches.
+
+By default @samp{-mno-ignore-branch-isa} is selected, causing any invalid
+branch requiring a transition between ISA modes to produce an error.
+
@cindex @option{-mnan=} command line option, MIPS
@item -mnan=@var{encoding}
This option indicates whether the source code uses the IEEE 2008
diff --git a/gas/testsuite/gas/mips/branch-local-ignore-2.d b/gas/testsuite/gas/mips/branch-local-ignore-2.d
new file mode 100644
index 0000000..ddac741
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-2.d
@@ -0,0 +1,29 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 2 (ignore branch ISA)
+#as: -32 -mignore-branch-isa
+#source: branch-local-2.s
+
+.*: +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]+ <[^>]*> 1000ffff b 00001014 <bar\+0x4>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 1443ffff bne v0,v1,0000101c <bar\+0xc>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 0451ffff bgezal v0,00001024 <bar\+0x14>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 0450ffff bltzal v0,0000102c <bar\+0x1c>
+[ ]*[0-9a-f]+: R_MIPS_PC16 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/gas/testsuite/gas/mips/branch-local-ignore-3.d b/gas/testsuite/gas/mips/branch-local-ignore-3.d
new file mode 100644
index 0000000..918a2ce
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-3.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32r6
+#name: MIPS branch local symbol relocation 3 (ignore branch ISA)
+#as: -32 -mignore-branch-isa
+#source: branch-local-3.s
+
+.*: +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]+ <[^>]*> cbffffff bc 00001014 <bar\+0x4>
+[ ]*[0-9a-f]+: R_MIPS_PC26_S2 foo
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> d85fffff beqzc v0,0000101c <bar\+0xc>
+[ ]*[0-9a-f]+: R_MIPS_PC21_S2 foo
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jr ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n32-2.d b/gas/testsuite/gas/mips/branch-local-ignore-n32-2.d
new file mode 100644
index 0000000..080402c
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-n32-2.d
@@ -0,0 +1,29 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 2 (ignore branch ISA, n32)
+#as: -n32 -march=from-abi -mignore-branch-isa
+#source: branch-local-2.s
+
+.*: +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]+ <[^>]*> 10000000 b 00001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 14430000 bne v0,v1,00001020 <bar\+0x10>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 04510000 bgezal v0,00001028 <bar\+0x18>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 04500000 bltzal v0,00001030 <bar\+0x20>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[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/gas/testsuite/gas/mips/branch-local-ignore-n32-3.d b/gas/testsuite/gas/mips/branch-local-ignore-n32-3.d
new file mode 100644
index 0000000..a4dbc7f
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-n32-3.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32r6
+#name: MIPS branch local symbol relocation 3 (ignore branch ISA, n32)
+#as: -n32 -march=from-abi -mignore-branch-isa
+#source: branch-local-3.s
+
+.*: +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]+ <[^>]*> c8000000 bc 00001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MIPS_PC26_S2 foo-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> d8400000 beqzc v0,00001020 <bar\+0x10>
+[ ]*[0-9a-f]+: R_MIPS_PC21_S2 foo-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jr ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n64-2.d b/gas/testsuite/gas/mips/branch-local-ignore-n64-2.d
new file mode 100644
index 0000000..12cd510
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-n64-2.d
@@ -0,0 +1,37 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS branch local symbol relocation 2 (ignore branch ISA, n64)
+#as: -64 -march=from-abi -mignore-branch-isa
+#source: branch-local-2.s
+
+.*: +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]+ <[^>]*> 10000000 b 0000000000001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 14430000 bne v0,v1,0000000000001020 <bar\+0x10>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 04510000 bgezal v0,0000000000001028 <bar\+0x18>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 04500000 bltzal v0,0000000000001030 <bar\+0x20>
+[ ]*[0-9a-f]+: R_MIPS_PC16 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[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/gas/testsuite/gas/mips/branch-local-ignore-n64-3.d b/gas/testsuite/gas/mips/branch-local-ignore-n64-3.d
new file mode 100644
index 0000000..9d6dca9
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-local-ignore-n64-3.d
@@ -0,0 +1,27 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32r6
+#name: MIPS branch local symbol relocation 3 (ignore branch ISA, n64)
+#as: -64 -march=from-abi -mignore-branch-isa
+#source: branch-local-3.s
+
+.*: +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]+ <[^>]*> c8000000 bc 0000000000001018 <bar\+0x8>
+[ ]*[0-9a-f]+: R_MIPS_PC26_S2 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> d8400000 beqzc v0,0000000000001020 <bar\+0x10>
+[ ]*[0-9a-f]+: R_MIPS_PC21_S2 foo-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*-0x4
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+[0-9a-f]+ <[^>]*> 03e00009 jr ra
+[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 4580fbf..5a69542 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -626,16 +626,22 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "branch-weak-7"
run_dump_test "branch-local-1"
run_dump_test "branch-local-2"
+ run_dump_test "branch-local-ignore-2"
run_dump_test "branch-local-3"
+ run_dump_test "branch-local-ignore-3"
run_dump_test "branch-local-4"
if $has_newabi {
run_dump_test "branch-local-n32-1"
run_dump_test "branch-local-n32-2"
+ run_dump_test "branch-local-ignore-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-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-addend"