From 754e2bb9487bca613fbcf442e982d8842d81ad29 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 2 May 2013 22:30:11 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (mips_pseudo_table): Add stabd and stabs entries. (s_mips_stab): Do not restrict to stabn only. gas/testsuite/ * gas/mips/mips16-stabs.s, gas/mips/mips16-stabs.d: New test. * gas/mips/mips.exp: Run it. --- gas/ChangeLog | 5 +++++ gas/config/tc-mips.c | 24 ++++++++++++++++-------- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/mips/mips.exp | 1 + gas/testsuite/gas/mips/mips16-stabs.d | 6 ++++++ gas/testsuite/gas/mips/mips16-stabs.s | 8 ++++++++ 6 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 gas/testsuite/gas/mips/mips16-stabs.d create mode 100644 gas/testsuite/gas/mips/mips16-stabs.s diff --git a/gas/ChangeLog b/gas/ChangeLog index e4f896ad2d..417e5ed532 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2013-05-02 Richard Sandiford + + * config/tc-mips.c (mips_pseudo_table): Add stabd and stabs entries. + (s_mips_stab): Do not restrict to stabn only. + 2013-05-02 Nick Clifton * config/tc-msp430.c: Add support for the MSP430X architecture. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 29d2c02254..012935d354 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1472,7 +1472,9 @@ static const pseudo_typeS mips_pseudo_table[] = {"section", s_change_section, 0}, {"short", s_cons, 1}, {"single", s_float_cons, 'f'}, + {"stabd", s_mips_stab, 'd'}, {"stabn", s_mips_stab, 'n'}, + {"stabs", s_mips_stab, 's'}, {"text", s_change_sec, 't'}, {"word", s_cons, 2}, @@ -17088,18 +17090,24 @@ s_insn (int ignore ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } -/* Handle a .stabn directive. We need these in order to mark a label - as being a mips16 text label correctly. Sometimes the compiler - will emit a label, followed by a .stabn, and then switch sections. - If the label and .stabn are in mips16 mode, then the label is - really a mips16 text label. */ +/* Handle a .stab[snd] directive. Ideally these directives would be + implemented in a transparent way, so that removing them would not + have any effect on the generated instructions. However, s_stab + internally changes the section, so in practice we need to decide + now whether the preceding label marks compressed code. We do not + support changing the compression mode of a label after a .stab* + directive, such as in: + + foo: + .stabs ... + .set mips16 + + so the current mode wins. */ static void s_mips_stab (int type) { - if (type == 'n') - mips_mark_labels (); - + mips_mark_labels (); s_stab (type); } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index bd015c6995..f73e188ebf 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-05-02 Richard Sandiford + + * gas/mips/mips16-stabs.s, gas/mips/mips16-stabs.d: New test. + * gas/mips/mips.exp: Run it. + 2013-05-02 Nick Clifton * gas/all/gas.exp: Skip the DIFF1 test for the MSP430. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index c387ce55b7..48bd33e4fa 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1086,6 +1086,7 @@ if { [istarget mips*-*-vxworks*] } { if $has_newabi { run_dump_test "mips16-dwarf2-n32" } + run_dump_test "mips16-stabs" } if { !$no_mips16 } { run_dump_test "mips16e-jrc" diff --git a/gas/testsuite/gas/mips/mips16-stabs.d b/gas/testsuite/gas/mips/mips16-stabs.d new file mode 100644 index 0000000000..db7673a984 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-stabs.d @@ -0,0 +1,6 @@ +#as: -mips3 -EB +#objdump: -dr +#... +0+ : + 0: e820 jr ra +#pass diff --git a/gas/testsuite/gas/mips/mips16-stabs.s b/gas/testsuite/gas/mips/mips16-stabs.s new file mode 100644 index 0000000000..f44ad6a646 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-stabs.s @@ -0,0 +1,8 @@ + .align 2 + .set mips16 + .globl foo + .ent foo +foo: + .stabs "foo:F(0,49)",36,0,0,foo + jr $31 + .end foo -- 2.34.1