aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2020-07-20 08:57:18 +0200
committerJan Beulich <jbeulich@suse.com>2020-07-20 08:57:18 +0200
commitb3983e5f53caad175563f8c842f2ab2a1277c2bc (patch)
tree6d5e3343f11a36633999b33996e210b4edd1650e /gas/testsuite
parent750e4bf70f2caab39dc5d0a1b2d26c9ca1fbd909 (diff)
downloadgdb-b3983e5f53caad175563f8c842f2ab2a1277c2bc.zip
gdb-b3983e5f53caad175563f8c842f2ab2a1277c2bc.tar.gz
gdb-b3983e5f53caad175563f8c842f2ab2a1277c2bc.tar.bz2
x86: handle SVR4 escaped binary operators
PR gas/4572 When / is a comment character, its use as binary "divide" operator needs escaping by a backslash. Besides the scrubber needing to support this (addressed in an earlier change), there are also a few provisions needed in target specific operator handling. As the spec calls for % and * to also be escaped because of being "overloaded", also recognize these, despite the overloading there not really preventing their use as operators in most (%) or all (*) cases, given the way how the rest of the assembler works. To bring source and testsuite in line, also drop the TE_I386AIX part of the respective conditional, as i?86-*-aix* support had been removed a while ago.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/i386.exp8
-rw-r--r--gas/testsuite/gas/i386/svr4.d24
-rw-r--r--gas/testsuite/gas/i386/svr4.s31
3 files changed, 63 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index f401732..a91ad79 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -692,6 +692,14 @@ if [expr [istarget "i*86-*-*"] || [istarget "x86_64-*-*"]] then {
run_dump_test "dw2-compressed-1"
run_dump_test "dw2-compressed-3a"
run_dump_test "dw2-compressed-3b"
+
+ if {![istarget "*-*-dragonfly*"]
+ && ![istarget "*-*-gnu*"]
+ && ![istarget "*-*-freebsd*"]
+ && ![istarget "*-*-linux*"]
+ && ![istarget "*-*-netbsd*"]} then {
+ run_dump_test "svr4"
+ }
}
}
diff --git a/gas/testsuite/gas/i386/svr4.d b/gas/testsuite/gas/i386/svr4.d
new file mode 100644
index 0000000..3a46354
--- /dev/null
+++ b/gas/testsuite/gas/i386/svr4.d
@@ -0,0 +1,24 @@
+#objdump: -dtw
+#name: SVR4 comment char escape handling
+
+.*: +file format .*
+
+SYMBOL TABLE:
+0+00 .* \.text[ ]+0+ \.text
+0+00 .* \.data[ ]+0+ \.data
+0+00 .* \.bss[ ]+0+ \.bss
+0+00 .* \.text[ ]+0+ svr4
+0+04 .* \*ABS\*[ ]+0+ a
+0+03 .* \*ABS\*[ ]+0+ b
+0+4c .* \*ABS\*[ ]+0+ c
+
+Disassembly of section .text:
+
+0+0 <svr4>:
+[ ]*[0-9a-f]+:[ ]+b0 07[ ]+mov \$0x7,%al
+[ ]*[0-9a-f]+:[ ]+b0 01[ ]+mov \$0x1,%al
+[ ]*[0-9a-f]+:[ ]+b0 1e[ ]+mov \$0x1e,%al
+[ ]*[0-9a-f]+:[ ]+b0 05[ ]+mov \$0x5,%al
+[ ]*[0-9a-f]+:[ ]+b0 02[ ]+mov \$0x2,%al
+[ ]*[0-9a-f]+:[ ]+b0 33[ ]+mov \$0x33,%al
+#pass
diff --git a/gas/testsuite/gas/i386/svr4.s b/gas/testsuite/gas/i386/svr4.s
new file mode 100644
index 0000000..4565e01
--- /dev/null
+++ b/gas/testsuite/gas/i386/svr4.s
@@ -0,0 +1,31 @@
+ .text
+
+ .if 1 / 2
+ .else
+ .error
+ .endif
+
+ .if 1 \/ 2
+ .error
+ .endif
+
+ .if 4 \% 2
+ .error
+ .endif
+
+ .if 1 \* 0
+ .error
+ .endif
+
+svr4:
+ mov $(15 \/ 2), %al
+ mov $(15 \% 2), %al
+ mov $(15 \* 2), %al
+
+ .byte 0xb0, 17 \/ 3
+ .byte 0xb0, 17 \% 3
+ .byte 0xb0, 17 \* 3
+
+ .equiv a, 19 \/ 4
+ .equiv b, 19 \% 4
+ .equiv c, 19 \* 4