[v3,3/3] gas: Add macro tests for PR gas/32073
Checks
Commit Message
1. Add a macro test with expression argument and a white space before
argument added by C preprocessor.
2. Add a x86-64 specific macro test.
PR gas/32073
* testsuite/gas/i386/x86-64-macro-1.d: New file.
* testsuite/gas/i386/x86-64-macro-1.s: Likewise.
* testsuite/gas/i386/x86-64.exp: Run x86-64-macro-1.
* testsuite/gas/macros/arg1.d: New file.
* testsuite/gas/macros/arg1.s: Likewise.
* testsuite/gas/macros/macros.exp: Run arg1.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
gas/testsuite/gas/i386/x86-64-macro-1.d | 11 +++++++++++
gas/testsuite/gas/i386/x86-64-macro-1.s | 9 +++++++++
gas/testsuite/gas/i386/x86-64.exp | 2 ++
gas/testsuite/gas/macros/arg1.d | 7 +++++++
gas/testsuite/gas/macros/arg1.s | 12 ++++++++++++
gas/testsuite/gas/macros/macros.exp | 2 ++
6 files changed, 43 insertions(+)
create mode 100644 gas/testsuite/gas/i386/x86-64-macro-1.d
create mode 100644 gas/testsuite/gas/i386/x86-64-macro-1.s
create mode 100644 gas/testsuite/gas/macros/arg1.d
create mode 100644 gas/testsuite/gas/macros/arg1.s
Comments
On 12.08.2024 17:12, H.J. Lu wrote:
> --- /dev/null
> +++ b/gas/testsuite/gas/macros/arg1.d
> @@ -0,0 +1,7 @@
> +#objdump: -s -j .data
> +
> +.*: .*
> +
> +Contents of section .data:
> + 0000 10111213 1415 ......
> +#pass
Despite the #pass, isn't this going to fail for targets which pad sections
to certain alignment? Or was that an issue only with text sections?
> --- /dev/null
> +++ b/gas/testsuite/gas/macros/arg1.s
> @@ -0,0 +1,12 @@
> +# Test expression argument and a white space before argument added by
> +# C preprocessor.
Nit: It's not really "expression" that matters here, but expressions with
inner whitespace.
Jan
On Mon, Aug 12, 2024 at 8:29 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 12.08.2024 17:12, H.J. Lu wrote:
> > --- /dev/null
> > +++ b/gas/testsuite/gas/macros/arg1.d
> > @@ -0,0 +1,7 @@
> > +#objdump: -s -j .data
> > +
> > +.*: .*
> > +
> > +Contents of section .data:
> > + 0000 10111213 1415 ......
> > +#pass
>
> Despite the #pass, isn't this going to fail for targets which pad sections
> to certain alignment? Or was that an issue only with text sections?
I don't think we pad data section.
> > --- /dev/null
> > +++ b/gas/testsuite/gas/macros/arg1.s
> > @@ -0,0 +1,12 @@
> > +# Test expression argument and a white space before argument added by
> > +# C preprocessor.
>
> Nit: It's not really "expression" that matters here, but expressions with
> inner whitespace.
>
> Jan
Will fix.
On Mon, Aug 12, 2024 at 08:35:56AM -0700, H.J. Lu wrote:
> On Mon, Aug 12, 2024 at 8:29 AM Jan Beulich <jbeulich@suse.com> wrote:
> >
> > On 12.08.2024 17:12, H.J. Lu wrote:
> > > --- /dev/null
> > > +++ b/gas/testsuite/gas/macros/arg1.d
> > > @@ -0,0 +1,7 @@
> > > +#objdump: -s -j .data
> > > +
> > > +.*: .*
> > > +
> > > +Contents of section .data:
> > > + 0000 10111213 1415 ......
> > > +#pass
> >
> > Despite the #pass, isn't this going to fail for targets which pad sections
> > to certain alignment? Or was that an issue only with text sections?
>
> I don't think we pad data section.
We do, and there are targets that have 2 or 4 octets per byte. And some
that don't have '#' as a line comment char. Huh, and tic6x-elf fails
the test with "Error: too many positional arguments". So not all
targets strip out whitespace.
aarch64-pe +FAIL: gas/macros/arg1
alpha-linux-gnuecoff +FAIL: gas/macros/arg1
arm-pe +FAIL: gas/macros/arg1
arm-wince-pe +FAIL: gas/macros/arg1
bfin-elf +FAIL: gas/macros/arg1
bfin-linux-uclibc +FAIL: gas/macros/arg1
bfin-uclinux +FAIL: gas/macros/arg1
hppa-hp-hpux10 +FAIL: gas/macros/arg1
i386-bsd +FAIL: gas/macros/arg1
i386-go32 +FAIL: gas/macros/arg1
i386-msdos +FAIL: gas/macros/arg1
i686-pe +FAIL: gas/macros/arg1
mcore-pe +FAIL: gas/macros/arg1
mips64el-openbsd +FAIL: gas/macros/arg1
mips64-linux-gnuabi64 +FAIL: gas/macros/arg1
mips64-openbsd +FAIL: gas/macros/arg1
mipsel-linux-gnu +FAIL: gas/macros/arg1
mipsisa32el-linux-gnu +FAIL: gas/macros/arg1
mips-linux-gnu +FAIL: gas/macros/arg1
mips-sgi-irix6 +FAIL: gas/macros/arg1
powerpc-aix5.1 +FAIL: gas/macros/arg1
powerpc-aix7.2 +FAIL: gas/macros/arg1
rs6000-aix4.3.3 +FAIL: gas/macros/arg1
rs6000-aix5.1 +FAIL: gas/macros/arg1
rs6000-aix7.2 +FAIL: gas/macros/arg1
s390-linux-gnu +FAIL: gas/macros/arg1
s390x-linux-gnu +FAIL: gas/macros/arg1
sh-coff +FAIL: gas/macros/arg1
sh-pe +FAIL: gas/macros/arg1
tic30-unknown-coff +FAIL: gas/macros/arg1
tic4x-coff +FAIL: gas/macros/arg1
tic54x-coff +FAIL: gas/macros/arg1
tic6x-elf +FAIL: gas/macros/arg1
x86_64-w64-mingw32 +FAIL: gas/macros/arg1
* testsuite/gas/macros/arg1.s: Pad out data section. Use C style
comments.
* testsuite/gas/macros/arg1.d: Adjust to suit. Don't run on
multi-octet per byte targes. xfail tic6x.
diff --git a/gas/testsuite/gas/macros/arg1.d b/gas/testsuite/gas/macros/arg1.d
index 0a9d8b10fdb..adb24c9ac65 100644
--- a/gas/testsuite/gas/macros/arg1.d
+++ b/gas/testsuite/gas/macros/arg1.d
@@ -1,7 +1,9 @@
#objdump: -s -j .data
+# tic30 and tic4x have 4 octets per byte, tic54x has 2 octets per byte
+#notarget: tic30-*-* tic4x-*-* tic54x-*-*
+#xfail: tic6x-*-*
.*: .*
Contents of section .data:
- 0000 10111213 1415 ......
-#pass
+ 0000 10111213 14150000 00000000 00000000 .*
diff --git a/gas/testsuite/gas/macros/arg1.s b/gas/testsuite/gas/macros/arg1.s
index e0cb0bddc32..7eecc97f17c 100644
--- a/gas/testsuite/gas/macros/arg1.s
+++ b/gas/testsuite/gas/macros/arg1.s
@@ -1,5 +1,5 @@
-# Test expression argument with inner white spaces and a white space
-# before argument added by C preprocessor.
+/* Test expression argument with inner white spaces and a white space
+ before argument added by C preprocessor. */
.macro test arg1, arg2, arg3
.byte \arg1
@@ -10,3 +10,4 @@
.data
test 0x10 + 0, 0x10 + 1, 0x10 + 2
test 0x10 + 3, 0x10 + 4, 0x15
+ .byte 0,0,0,0,0,0,0,0,0,0
new file mode 100644
@@ -0,0 +1,11 @@
+#as: -mrelax-relocations=yes
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: ff 15 00 00 00 00 call \*0x0\(%rip\) # 6 <_start\+0x6> 2: R_X86_64_GOTPCRELX acos-0x4
+#pass
new file mode 100644
@@ -0,0 +1,9 @@
+# Test a white space before argument added by C preprocessor.
+
+ .macro WRAPPER_IMPL_SSE2 callee
+ call *\ callee@GOTPCREL(%rip)
+ .endm
+
+ .text
+_start:
+ WRAPPER_IMPL_SSE2 acos
@@ -698,6 +698,8 @@ if [is_elf_format] then {
run_dump_test "x86-64-no-got"
+ run_dump_test "x86-64-macro-1"
+
run_dump_test "x86-64-addend"
run_dump_test "x86-64-nop-3"
run_dump_test "x86-64-nop-4"
new file mode 100644
@@ -0,0 +1,7 @@
+#objdump: -s -j .data
+
+.*: .*
+
+Contents of section .data:
+ 0000 10111213 1415 ......
+#pass
new file mode 100644
@@ -0,0 +1,12 @@
+# Test expression argument and a white space before argument added by
+# C preprocessor.
+
+ .macro test arg1, arg2, arg3
+ .byte \arg1
+ .byte \arg2
+ .byte \ arg3
+ .endm
+
+ .data
+ test 0x10 + 0, 0x10 + 1, 0x10 + 2
+ test 0x10 + 3, 0x10 + 4, 0x15
@@ -75,6 +75,8 @@ if { ![istarget tic30-*-*] } {
run_list_test app6 ""
}
+run_dump_test arg1
+
run_list_test badarg ""
switch -glob $target_triplet {