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.
This commit is contained in:
James Cowgill 2017-09-22 00:54:19 +01:00 committed by Maciej W. Rozycki
parent 757bf54bb4
commit 42c0794e96
7 changed files with 49 additions and 0 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,3 @@
.text
foo:
.stabd 0, 0, 0