aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cowgill <James.Cowgill@imgtec.com>2017-09-22 00:54:19 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2017-09-22 00:54:19 +0100
commit42c0794e961fd7922ad1358bd7221a8c85278ccc (patch)
treeb5f0280aab319cd0f4f22a29a21d67bc4af041f2
parent757bf54bb48a8417154cfdd7128c1775d43478d8 (diff)
downloadgdb-42c0794e961fd7922ad1358bd7221a8c85278ccc.zip
gdb-42c0794e961fd7922ad1358bd7221a8c85278ccc.tar.gz
gdb-42c0794e961fd7922ad1358bd7221a8c85278ccc.tar.bz2
PR gas/21762: MIPS: Fix .stabs directive marking labels as MIPS16
If a .stabs directive was used before another .set directive in a MIPS source file, s_mips_stab would call mips_mark_labels without having initialized the mips_opts structure yet. Fix this by calling file_mips_check_options which will initialize mips_opts if necessary. gas/ PR gas/21762 * config/tc-mips.c (s_mips_stab): Insert call to file_mips_check_options. * testsuite/gas/mips/micromips@stabs-symbol-type.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests. * testsuite/gas/mips/mips16@stabs-symbol-type.d: New test. * testsuite/gas/mips/stabs-symbol-type.d: New test. * testsuite/gas/mips/stabs-symbol-type.s: New test source.
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/config/tc-mips.c1
-rw-r--r--gas/testsuite/gas/mips/micromips@stabs-symbol-type.d11
-rw-r--r--gas/testsuite/gas/mips/mips.exp2
-rw-r--r--gas/testsuite/gas/mips/mips16@stabs-symbol-type.d11
-rw-r--r--gas/testsuite/gas/mips/stabs-symbol-type.d10
-rw-r--r--gas/testsuite/gas/mips/stabs-symbol-type.s3
7 files changed, 49 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c5f19ff..7c9e61f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-21 James Cowgill <James.Cowgill@imgtec.com>
+
+ PR gas/21762
+ * config/tc-mips.c (s_mips_stab): Insert call to
+ file_mips_check_options.
+ * testsuite/gas/mips/micromips@stabs-symbol-type.d: New test.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+ * testsuite/gas/mips/mips16@stabs-symbol-type.d: New test.
+ * testsuite/gas/mips/stabs-symbol-type.d: New test.
+ * testsuite/gas/mips/stabs-symbol-type.s: New test source.
+
2017-09-21 Alan Modra <amodra@gmail.com>
* config/tc-ppc.h (EH_FRAME_ALIGNMENT): Define.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 43a7033..e4351f7 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -17149,6 +17149,7 @@ s_nan (int ignore ATTRIBUTE_UNUSED)
static void
s_mips_stab (int type)
{
+ file_mips_check_options ();
mips_mark_labels ();
s_stab (type);
}
diff --git a/gas/testsuite/gas/mips/micromips@stabs-symbol-type.d b/gas/testsuite/gas/mips/micromips@stabs-symbol-type.d
new file mode 100644
index 0000000..c93efe5
--- /dev/null
+++ b/gas/testsuite/gas/mips/micromips@stabs-symbol-type.d
@@ -0,0 +1,11 @@
+#PROG: readelf
+#readelf: -s
+#name: MIPS .stab symbol type
+#as: -32
+#source: stabs-symbol-type.s
+
+# Verify the symbol type when emitting a .stab directive.
+# In this case, it should be MICROMIPS.
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +NOTYPE +LOCAL +DEFAULT +\[MICROMIPS\] +[0-9]+ foo
+#pass
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index c71dca4..0f259d3 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -2034,6 +2034,8 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "org-11"
run_dump_test "org-12"
+ run_dump_test_arches "stabs-symbol-type" [mips_arch_list_all]
+
run_dump_test_arches "r6" [mips_arch_list_matching mips32r6]
if $has_newabi {
run_dump_test_arches "r6-n32" [mips_arch_list_matching mips64r6]
diff --git a/gas/testsuite/gas/mips/mips16@stabs-symbol-type.d b/gas/testsuite/gas/mips/mips16@stabs-symbol-type.d
new file mode 100644
index 0000000..b37aa1e
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16@stabs-symbol-type.d
@@ -0,0 +1,11 @@
+#PROG: readelf
+#readelf: -s
+#name: MIPS .stab symbol type
+#as: -32
+#source: stabs-symbol-type.s
+
+# Verify the symbol type when emitting a .stab directive.
+# In this case, it should be MIPS16.
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +NOTYPE +LOCAL +DEFAULT +\[MIPS16\] +[0-9]+ foo
+#pass
diff --git a/gas/testsuite/gas/mips/stabs-symbol-type.d b/gas/testsuite/gas/mips/stabs-symbol-type.d
new file mode 100644
index 0000000..4f8501d
--- /dev/null
+++ b/gas/testsuite/gas/mips/stabs-symbol-type.d
@@ -0,0 +1,10 @@
+#PROG: readelf
+#readelf: -s
+#name: MIPS .stab symbol type
+#as: -32
+
+# Verify the symbol type when emitting a .stab directive.
+# In this case, it should not be MIPS16 or MICROMIPS.
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ foo
+#pass
diff --git a/gas/testsuite/gas/mips/stabs-symbol-type.s b/gas/testsuite/gas/mips/stabs-symbol-type.s
new file mode 100644
index 0000000..26b46f4
--- /dev/null
+++ b/gas/testsuite/gas/mips/stabs-symbol-type.s
@@ -0,0 +1,3 @@
+ .text
+foo:
+ .stabd 0, 0, 0