]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
MIPS/GAS: Correct file option settings with `.insn'
authorMaciej W. Rozycki <macro@codesourcery.com>
Tue, 21 Oct 2014 22:06:23 +0000 (23:06 +0100)
committerMatthew Fortune <matthew.fortune@imgtec.com>
Tue, 28 Oct 2014 13:00:43 +0000 (13:00 +0000)
Import from trunk.

This makes sure `HAVE_CODE_COMPRESSION' evaluates correctly when the
`.insn' directive is used at the beginning of a source file before any
instructions have been produced and that ELF file header's MIPS16 and
microMIPS ASE flags are set correctly in the case where no instructions
have been produced other than with the said directive.

gas/
* config/tc-mips.c (s_insn): Set file options.

gas/testsuite/
* gas/mips/insn-opts.d: New test.
* gas/mips/insn-opts.s: New test source.
* gas/mips/mips.exp: Run the new test.

gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/insn-opts.d [new file with mode: 0644]
gas/testsuite/gas/mips/insn-opts.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index c61cd6e96e6eea9a380b8b8bdedddec36333f1f4..e24e6bc72eaf0e0230e7028e8e5adfc3b4dda07e 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-28  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       Apply trunk patches
+       2014-10-21  Maciej W. Rozycki  <macro@codesourcery.com>
+       * config/tc-mips.c (s_insn): Set file options.
+
 2014-10-28  Matthew Fortune  <matthew.fortune@imgtec.com>
 
        Apply trunk patches
index 8d4a80bb182a121a0709b25c66774511c9a262d1..54442f4025ac1bd8bf970f64b40f54579639a247 100644 (file)
@@ -16344,6 +16344,10 @@ s_cpadd (int ignore ATTRIBUTE_UNUSED)
 static void
 s_insn (int ignore ATTRIBUTE_UNUSED)
 {
+  file_mips_check_options ();
+  file_ase_mips16 |= mips_opts.mips16;
+  file_ase_micromips |= mips_opts.micromips;
+
   mips_mark_labels ();
 
   demand_empty_rest_of_line ();
index b391709ed7fee191bc7f2fb086f2f2b6e8ed2238..90c9d57b911800be03d1e57a64311345a2f5eddd 100644 (file)
@@ -1,3 +1,11 @@
+2014-10-28  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       Apply trunk patches
+       2014-10-21  Maciej W. Rozycki  <macro@codesourcery.com>
+       * gas/mips/insn-opts.d: New test.
+       * gas/mips/insn-opts.s: New test source.
+       * gas/mips/mips.exp: Run the new test.
+
 2014-10-28  Alan Modra  <amodra@gmail.com>
 
        Apply truck patches
diff --git a/gas/testsuite/gas/mips/insn-opts.d b/gas/testsuite/gas/mips/insn-opts.d
new file mode 100644 (file)
index 0000000..a61c95e
--- /dev/null
@@ -0,0 +1,18 @@
+#objdump: -dtz -j .text --prefix-addresses --show-raw-insn
+#name: MIPS .insn default file options
+
+# Check that .insn at the beginning of assembly sees default file options
+# such as the ISA mode right.
+
+.*: +file format .*mips.*
+
+SYMBOL TABLE:
+0+000000 l    d  \.text        0+000000 \.text
+0+000000 g     F \.text        0+000004 foo
+0+000004 g     F \.text        0+000004 0x80 bar
+0+000008 g     O \.text        0+000004 baz
+
+Disassembly of section \.text:
+0+000000 <foo> 00000000        nop
+0+000004 <bar> 0000 0000       nop
+0+000008 <baz> .*
diff --git a/gas/testsuite/gas/mips/insn-opts.s b/gas/testsuite/gas/mips/insn-opts.s
new file mode 100644 (file)
index 0000000..a9ece0b
--- /dev/null
@@ -0,0 +1,23 @@
+       .text
+
+       .globl  foo
+       .type   foo, @function
+foo:
+       .insn
+       .dc.l   0
+       .size   foo, . - foo
+
+       .set    micromips
+
+       .globl  bar
+       .type   bar, @function
+bar:
+       .insn
+       .dc.l   0
+       .size   bar, . - bar
+
+       .globl  baz
+       .type   baz, @object
+baz:
+       .dc.l   0
+       .size   baz, . - baz
index 4afd367b271d7072dfb0a1bb7331848016eba03c..5750b754dd125f6509587895d9a749cd0eb1d235 100644 (file)
@@ -1134,6 +1134,7 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "align3"
     run_dump_test "odd-float"
     run_dump_test "ehword"
+    run_dump_test "insn-opts"
 
     run_list_test_arches "mips-macro-ill-sfp" "-32 -msingle-float" \
                                        [mips_arch_list_matching mips2]