aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@codesourcery.com>2014-10-21 23:06:23 +0100
committerMaciej W. Rozycki <macro@codesourcery.com>2014-10-21 23:06:23 +0100
commit7bb01e2d7401f2eb8995d445917708209d3ad4bf (patch)
tree664e115ce41ea5f5f80d970bf608c360a0d79bd1 /gas
parent80272b8cb9f78cd97c4655019e7826b6d4c5dd41 (diff)
downloadgdb-7bb01e2d7401f2eb8995d445917708209d3ad4bf.zip
gdb-7bb01e2d7401f2eb8995d445917708209d3ad4bf.tar.gz
gdb-7bb01e2d7401f2eb8995d445917708209d3ad4bf.tar.bz2
MIPS/GAS: Correct file option settings with `.insn'
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-mips.c4
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/mips/insn-opts.d18
-rw-r--r--gas/testsuite/gas/mips/insn-opts.s23
-rw-r--r--gas/testsuite/gas/mips/mips.exp1
6 files changed, 56 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4f923ed..d246494 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-21 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config/tc-mips.c (s_insn): Set file options.
+
2014-10-21 Jan Beulich <jbeulich@suse.com>
* read.c (HANDLE_CONDITIONAL_ASSEMBLY): New parameter "num_read".
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 8d4a80b..54442f4 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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 ();
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index a79cd1c..4988b00 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+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-21 Jan Beulich <jbeulich@suse.com>
* gas/gas/all/cond.s: Also test processing of leading double
diff --git a/gas/testsuite/gas/mips/insn-opts.d b/gas/testsuite/gas/mips/insn-opts.d
new file mode 100644
index 0000000..a61c95e
--- /dev/null
+++ b/gas/testsuite/gas/mips/insn-opts.d
@@ -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
index 0000000..a9ece0b
--- /dev/null
+++ b/gas/testsuite/gas/mips/insn-opts.s
@@ -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
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 4afd367..5750b75 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -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]