summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-13 09:39:19 +1030
committerAlan Modra <amodra@gmail.com>2023-01-16 23:22:48 +1030
commit5999477d92aecd9df5fb0b2f04c33b987a7db40c (patch)
tree4701cb922714fc97b22e52f4b534bbbe1f3de9d2
parentf75c8fc014e2075ce36751565291afae898e2679 (diff)
downloadbinutils-gdb-5999477d92aecd9df5fb0b2f04c33b987a7db40c.tar.gz
PR29991, MicroMIPS flag erased after align directives
PR 29991 * config/tc-mips.c (s_align): Call file_mips_check_options and mips_mark_labels. * testsuite/gas/mips/align-after-label.s, * testsuite/gas/mips/mips-align-after-label.d, * testsuite/gas/mips/micromips-align-after-label.d: New test. * testsuite/gas/mips/mips.exp: Run it.
-rw-r--r--gas/config/tc-mips.c5
-rw-r--r--gas/testsuite/gas/mips/align-after-label.s3
-rw-r--r--gas/testsuite/gas/mips/micromips-align-after-label.d13
-rw-r--r--gas/testsuite/gas/mips/mips-align-after-label.d12
-rw-r--r--gas/testsuite/gas/mips/mips.exp2
5 files changed, 35 insertions, 0 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 077993cf7cb..e59021ee191 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -16262,6 +16262,8 @@ s_align (int x ATTRIBUTE_UNUSED)
int temp, fill_value, *fill_ptr;
long max_alignment = 28;
+ file_mips_check_options ();
+
/* o Note that the assembler pulls down any immediately preceding label
to the aligned address.
o It's not documented but auto alignment is reinstated by
@@ -16286,6 +16288,9 @@ s_align (int x ATTRIBUTE_UNUSED)
}
else
fill_ptr = 0;
+
+ mips_mark_labels ();
+
if (temp)
{
segment_info_type *si = seg_info (now_seg);
diff --git a/gas/testsuite/gas/mips/align-after-label.s b/gas/testsuite/gas/mips/align-after-label.s
new file mode 100644
index 00000000000..75e1c1bb6d0
--- /dev/null
+++ b/gas/testsuite/gas/mips/align-after-label.s
@@ -0,0 +1,3 @@
+seg1:
+ .align 2
+ ADDIU $0, $0, 1
diff --git a/gas/testsuite/gas/mips/micromips-align-after-label.d b/gas/testsuite/gas/mips/micromips-align-after-label.d
new file mode 100644
index 00000000000..9358b912626
--- /dev/null
+++ b/gas/testsuite/gas/mips/micromips-align-after-label.d
@@ -0,0 +1,13 @@
+#objdump: -dr --show-raw-insn
+#name: microMIPSr3 (align after label)
+#as: -mips32r3 -32 -mmicromips -EB
+#source: align-after-label.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <seg1>:
+[ 0-9a-f]+: 4c02 addiu zero,zero,1
+[ 0-9a-f]+: 0c00 nop
+#pass
diff --git a/gas/testsuite/gas/mips/mips-align-after-label.d b/gas/testsuite/gas/mips/mips-align-after-label.d
new file mode 100644
index 00000000000..8f3d40df8a8
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips-align-after-label.d
@@ -0,0 +1,12 @@
+#objdump: -dr --show-raw-insn
+#name: MIPS32r3 (align after label)
+#as: -mips32r3 -32 -mno-micromips -EB
+#source: align-after-label.s
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <seg1>:
+[ 0-9a-f]+: 24000001 li zero,1
+#pass
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index fafed2dcc0c..e358c9716a6 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1518,6 +1518,8 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "align2"
run_dump_test "align2-el"
run_dump_test "align3"
+ run_dump_test "mips-align-after-label"
+ run_dump_test "micromips-align-after-label"
run_dump_test "odd-float"
run_dump_test "insn-opts"