+2016-06-21 Maciej W. Rozycki <macro@imgtec.com>
+
+ * config/tc-mips.c (mips_force_relocation): Use `file_mips_opts'
+ rather than `mips_opts' for the R6 ISA check.
+ (mips_fix_adjustable): Likewise.
+ * testsuite/gas/mips/pcrel-reloc-1.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-1-r6.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-2.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-2-r6.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-3.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-3-r6.d: New test.
+ * testsuite/gas/mips/pcrel-reloc-1.s: New test source.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+
2016-06-21 Graham Markall <graham.markall@embecosm.com>
* config/tc-arc.c (check_cpu_feature, md_parse_option):
return 1;
/* We want all PC-relative relocations to be kept for R6 relaxation. */
- if (ISA_IS_R6 (mips_opts.isa)
+ if (ISA_IS_R6 (file_mips_opts.isa)
&& (fixp->fx_r_type == BFD_RELOC_16_PCREL_S2
|| fixp->fx_r_type == BFD_RELOC_MIPS_21_PCREL_S2
|| fixp->fx_r_type == BFD_RELOC_MIPS_26_PCREL_S2
Also, PC relative relocations for MIPS R6 need to be symbol rather than
section relative to allow linker relaxations to be performed later on. */
if (limited_pcrel_reloc_p (fixp->fx_r_type)
- && (HAVE_IN_PLACE_ADDENDS || ISA_IS_R6 (mips_opts.isa)))
+ && (HAVE_IN_PLACE_ADDENDS || ISA_IS_R6 (file_mips_opts.isa)))
return 0;
/* R_MIPS16_26 relocations against non-MIPS16 functions might resolve
run_dump_test "pcrel-4-64"
}
+ run_dump_test "pcrel-reloc-1"
+ run_dump_test "pcrel-reloc-1-r6"
+ run_dump_test "pcrel-reloc-2"
+ run_dump_test "pcrel-reloc-2-r6"
+ run_dump_test "pcrel-reloc-3"
+ run_dump_test "pcrel-reloc-3-r6"
+
run_dump_test_arches "attr-gnu-4-0" "-32" \
[mips_arch_list_matching mips1]
run_dump_test_arches "attr-gnu-4-0" "-64" \
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS R6 local PC-relative relocations 1
+#as: -32 -mips32r6
+#source: pcrel-reloc-1.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 1000ffff b 00000000 <foo>
+[ ]*[0-9a-f]+: R_MIPS_PC16 bar
+[0-9a-f]+ <[^>]*> 1000ffff b 00000004 <foo\+0x4>
+[ ]*[0-9a-f]+: R_MIPS_PC16 bar
+[0-9a-f]+ <[^>]*> 1000ffff b 00000008 <foo\+0x8>
+[ ]*[0-9a-f]+: R_MIPS_PC16 bar
+[0-9a-f]+ <[^>]*> 1000ffff b 0000000c <foo\+0xc>
+[ ]*[0-9a-f]+: R_MIPS_PC16 bar
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
+[0-9a-f]+ <[^>]*> 03e00009 jr ra
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS local PC-relative relocations 1
+#as: -32
+#source: pcrel-reloc-1.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 10000007 b 00000020 <bar>
+[0-9a-f]+ <[^>]*> 10000006 b 00000020 <bar>
+[0-9a-f]+ <[^>]*> 10000005 b 00000020 <bar>
+[0-9a-f]+ <[^>]*> 10000004 b 00000020 <bar>
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
+[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
--- /dev/null
+ .text
+ .align 4, 0
+ .globl foo
+ .ent foo
+ .set noreorder
+foo:
+ b bar
+ b bar
+ b bar
+ b bar
+ .set reorder
+ .end foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
+
+ .ent bar
+ .ifdef setmips3
+ .set mips3
+ .endif
+ .ifdef setmips64r6
+ .set mips64r6
+ .endif
+bar:
+ jalr $0, $ra
+ .end bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 16, 0
+ .space 16
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS R6 local PC-relative relocations 2
+#as: -32 -mips32r6 --defsym setmips3=1
+#source: pcrel-reloc-1.s
+#dump: pcrel-reloc-1-r6.d
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS local PC-relative relocations 2
+#as: -32 --defsym setmips3=1
+#source: pcrel-reloc-1.s
+#dump: pcrel-reloc-1.d
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS R6 local PC-relative relocations 3
+#as: -32 -mips32r6 --defsym setmips64r6=1
+#source: pcrel-reloc-1.s
+#dump: pcrel-reloc-1-r6.d
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS local PC-relative relocations 3
+#as: -32 --defsym setmips64r6=1
+#source: pcrel-reloc-1.s
+#dump: pcrel-reloc-1.d