This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR gas/21762: MIPS: Fix .stabs directive marking labels as MIPS16


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42c0794e961fd7922ad1358bd7221a8c85278ccc

commit 42c0794e961fd7922ad1358bd7221a8c85278ccc
Author: James Cowgill <James.Cowgill@imgtec.com>
Date:   Fri Sep 22 00:54:19 2017 +0100

    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.

Diff:
---
 gas/ChangeLog                                        | 11 +++++++++++
 gas/config/tc-mips.c                                 |  1 +
 gas/testsuite/gas/mips/micromips@stabs-symbol-type.d | 11 +++++++++++
 gas/testsuite/gas/mips/mips.exp                      |  2 ++
 gas/testsuite/gas/mips/mips16@stabs-symbol-type.d    | 11 +++++++++++
 gas/testsuite/gas/mips/stabs-symbol-type.d           | 10 ++++++++++
 gas/testsuite/gas/mips/stabs-symbol-type.s           |  3 +++
 7 files changed, 49 insertions(+)

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]