aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-08-12 08:43:22 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-08-12 10:42:02 -0700
commita86cec1a6f5127fc66737f95c2ba7938a755b63f (patch)
treee6539d93177ea2b88635c295a5d34d9ab480ebef /gas
parent87582defe75340e0003d4700568322379e9bc9f6 (diff)
downloadgdb-a86cec1a6f5127fc66737f95c2ba7938a755b63f.zip
gdb-a86cec1a6f5127fc66737f95c2ba7938a755b63f.tar.gz
gdb-a86cec1a6f5127fc66737f95c2ba7938a755b63f.tar.bz2
gas: Add macro tests for PR gas/32073
1. Add a macro test for expression argument with inner white spaces 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>
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/gas/i386/x86-64-macro-1.d11
-rw-r--r--gas/testsuite/gas/i386/x86-64-macro-1.s9
-rw-r--r--gas/testsuite/gas/i386/x86-64.exp2
-rw-r--r--gas/testsuite/gas/macros/arg1.d7
-rw-r--r--gas/testsuite/gas/macros/arg1.s12
-rw-r--r--gas/testsuite/gas/macros/macros.exp2
6 files changed, 43 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/x86-64-macro-1.d b/gas/testsuite/gas/i386/x86-64-macro-1.d
new file mode 100644
index 0000000..586dbde
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-macro-1.d
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-macro-1.s b/gas/testsuite/gas/i386/x86-64-macro-1.s
new file mode 100644
index 0000000..20b4416
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-macro-1.s
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64.exp b/gas/testsuite/gas/i386/x86-64.exp
index a14ed32..57cb4aa 100644
--- a/gas/testsuite/gas/i386/x86-64.exp
+++ b/gas/testsuite/gas/i386/x86-64.exp
@@ -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"
diff --git a/gas/testsuite/gas/macros/arg1.d b/gas/testsuite/gas/macros/arg1.d
new file mode 100644
index 0000000..0a9d8b1
--- /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
diff --git a/gas/testsuite/gas/macros/arg1.s b/gas/testsuite/gas/macros/arg1.s
new file mode 100644
index 0000000..e0cb0bd
--- /dev/null
+++ b/gas/testsuite/gas/macros/arg1.s
@@ -0,0 +1,12 @@
+# Test expression argument with inner white spaces 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
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
index bb5d4ab..3e84902 100644
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -75,6 +75,8 @@ if { ![istarget tic30-*-*] } {
run_list_test app6 ""
}
+run_dump_test arg1
+
run_list_test badarg ""
switch -glob $target_triplet {