diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-01-02 06:09:30 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-01-02 14:58:48 +0800 |
commit | f087e2e3f6dece21c5cb6049b4531bf762a3068f (patch) | |
tree | cc879a649bec611bf6744a101ec40b56e948df69 /gas/testsuite | |
parent | 434deed44de4ea2daaa53f6d38495b9baf2ea9cb (diff) | |
download | gdb-f087e2e3f6dece21c5cb6049b4531bf762a3068f.zip gdb-f087e2e3f6dece21c5cb6049b4531bf762a3068f.tar.gz gdb-f087e2e3f6dece21c5cb6049b4531bf762a3068f.tar.bz2 |
gas: Revert PR 32391 related commits to fix 3 regressions
9f2e3c21f65 Fix the handling or arguments and macro pseudo-variables inside nested assembler macros.
introduced 3 regressions of PR gas/32484, PR gas/32486 and PR gas/32487.
Revert all PR 32391 related commits and add tests for PR gas/32484,
PR gas/32486, PR gas/32487.
PR gas/32484
PR gas/32486
PR gas/32487
* testsuite/gas/macros/macros.exp: Run nesting1, nesting2 and
nesting3.
* testsuite/gas/macros/nesting1.d: New file.
* testsuite/gas/macros/nesting1.s: Likewise.
* testsuite/gas/macros/nesting2.d: Likewise.
* testsuite/gas/macros/nesting2.s: Likewise.
* testsuite/gas/macros/nesting3.d: Likewise.
* testsuite/gas/macros/nesting3.s: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/macros/macros.exp | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting.d | 28 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting.s | 104 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting1.d | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting1.s | 14 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting2.d | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting2.s | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting3.d | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/nesting3.s | 13 |
9 files changed, 61 insertions, 133 deletions
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp index de3df4d..3593309 100644 --- a/gas/testsuite/gas/macros/macros.exp +++ b/gas/testsuite/gas/macros/macros.exp @@ -112,4 +112,6 @@ run_list_test count run_list_test irp-count run_list_test irpc-quote run_list_test rept-count -run_dump_test nesting +run_dump_test nesting1 +run_dump_test nesting2 +run_dump_test nesting3 diff --git a/gas/testsuite/gas/macros/nesting.d b/gas/testsuite/gas/macros/nesting.d deleted file mode 100644 index 2f44aed..0000000 --- a/gas/testsuite/gas/macros/nesting.d +++ /dev/null @@ -1,28 +0,0 @@ -#nm: -j -#name: Nested macros (PR 32391) -# Sone targets do not support macros used like this. -#skip: tic*-*-* mmix-* - -#... -_m7_ -_m8_ -after_at_0 -after_at_3 -after_plus_0 -after_plus_1 -before_at_0 -before_at_3 -before_plus_0 -before_plus_1 -bert -harryfred -i3_bar -inside_at_1 -inside_at_2 -inside_at_4 -inside_at_5 -inside_plus_0 -inside_plus_1 -jim -o3_foo -other_inner_6 diff --git a/gas/testsuite/gas/macros/nesting.s b/gas/testsuite/gas/macros/nesting.s deleted file mode 100644 index 9746ca1..0000000 --- a/gas/testsuite/gas/macros/nesting.s +++ /dev/null @@ -1,104 +0,0 @@ - .text -/* PR 32391: Automatic counters inside macros should increment when nested - macros finish execution. */ - .macro o1 - .global before_at_\@ -before_at_\@: - .global before_plus_\+ -before_plus_\+: - - .macro i1 - .global inside_at_\@ -inside_at_\@: - .global inside_plus_\+ -inside_plus_\+: - .endm - - i1 - i1 - - .global after_at_\@ -after_at_\@: - .global after_plus_\+ -after_plus_\+: - - .endm - -/* Invoking o1 should produce these symbols in this order: - - before_at_0 - before_plus_0 - inside_at_1 - inside_plus_0 - inside_at_2 - inside_plus_1 - after_at_0 - after_plus_0 */ - o1 - -/* A second invocation of o1 should not produce any errors about - symbols or macros being redefined. */ - o1 - -/* This definition should not collide with the definition inside o1. */ - .macro i1 - .global other_inner_\@ -other_inner_\@: - .endm - -/* And invoking it should invoke the second defintion of i1, not the first. */ - i1 - - .macro o2 - .global _m\@_ -_m\@_: - .macro i2 - .global _m\@_ -_m\@_: - .endm - i2 - .endm - -/* This should not generate conflicting symbols because the assembler - inserts the contents of o2 into the input buffer as pure text (ie - without evaluating i2). The first use of \@ is evaluated at this - time, creating _m4_. But the second use is not evaluated because - it is inside a .macro definition. - - This finishes the evaluation of o2, so the \@ counter is incremented. - - Next the input buffer is re-evaluated and the i2 macro definition - and invocation are encounterd. The text from i2 are inserted into - the input buffer and at this point the second use of \@ is evaluated - resulting in the creation of a symbol called _m5_. */ - o2 - -/* Macro arguments should be independent of nesting. */ - .macro O3 arg - .global o3_\arg -o3_\arg: - - .macro I3 arg - .global i3_\arg -i3_\arg: - .endm - - i3 bar /* Macro names are case insensitive. */ - .endm - - o3 foo /* Should produce two labels: o3_foo and i3_bar. */ - -/* Nested macros can access the arguments of their parents. - In addition their arguments can be substituted into the arguments - that are substited from their parents: */ - .macro OUTER arg1, arg2, arg3:vararg - .macro INNER arg4 arg2 - .dc.a \arg2 - .dc.a \arg3 - .endm - INNER \arg1 bert - .dc.a \arg2 - .endm - -/* This produces references to "jim", "bert" and "harryfred". */ - OUTER fred, jim, harry\arg4 diff --git a/gas/testsuite/gas/macros/nesting1.d b/gas/testsuite/gas/macros/nesting1.d new file mode 100644 index 0000000..10a90ab --- /dev/null +++ b/gas/testsuite/gas/macros/nesting1.d @@ -0,0 +1,7 @@ +#nm: -j +#name: Nested macros (PR 32484) +# Sone targets do not support macros used like this. +#skip: mmix-* + +#... +foo diff --git a/gas/testsuite/gas/macros/nesting1.s b/gas/testsuite/gas/macros/nesting1.s new file mode 100644 index 0000000..3d415e1 --- /dev/null +++ b/gas/testsuite/gas/macros/nesting1.s @@ -0,0 +1,14 @@ + .text +.macro entry fname +\fname: +.endm + +.macro func fname, t + entry \fname + .macro data + .dc.\()\t 0 + .endm + data +.endm + +func foo, a diff --git a/gas/testsuite/gas/macros/nesting2.d b/gas/testsuite/gas/macros/nesting2.d new file mode 100644 index 0000000..88649b1 --- /dev/null +++ b/gas/testsuite/gas/macros/nesting2.d @@ -0,0 +1,7 @@ +#nm: -j +#name: Nested macros (PR 32486) +# Sone targets do not support macros used like this. +#skip: mmix-* + +#... +foo diff --git a/gas/testsuite/gas/macros/nesting2.s b/gas/testsuite/gas/macros/nesting2.s new file mode 100644 index 0000000..ff8a7f4 --- /dev/null +++ b/gas/testsuite/gas/macros/nesting2.s @@ -0,0 +1,10 @@ +.macro function name + .macro endfunc + .endm + .text +\name: +.endm + +function foo + .dc.a 0 +endfunc diff --git a/gas/testsuite/gas/macros/nesting3.d b/gas/testsuite/gas/macros/nesting3.d new file mode 100644 index 0000000..2621957 --- /dev/null +++ b/gas/testsuite/gas/macros/nesting3.d @@ -0,0 +1,7 @@ +#nm: -j +#name: Nested macros (PR 32487) +# Sone targets do not support macros used like this. +#skip: mmix-* + +#... +foo diff --git a/gas/testsuite/gas/macros/nesting3.s b/gas/testsuite/gas/macros/nesting3.s new file mode 100644 index 0000000..4488009 --- /dev/null +++ b/gas/testsuite/gas/macros/nesting3.s @@ -0,0 +1,13 @@ + .text +.macro func + foo +.endm + +.macro do_foo +.macro foo +foo: + .dc.a 0 +.endm +.endm +do_foo +func |