aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-12-01 08:27:22 +0100
committerJan Beulich <jbeulich@suse.com>2023-12-01 08:27:22 +0100
commitb5482fe535884c9fdb5c45c5627ec99e54c0e9d9 (patch)
tree21441430a13f354e196c5fc3bc6d44e4ab8adbf0 /gas/testsuite
parent1f865bae65db9588f6994c02a92355bfb4e3d955 (diff)
downloadbinutils-b5482fe535884c9fdb5c45c5627ec99e54c0e9d9.zip
binutils-b5482fe535884c9fdb5c45c5627ec99e54c0e9d9.tar.gz
binutils-b5482fe535884c9fdb5c45c5627ec99e54c0e9d9.tar.bz2
x86: last-insn recording should be per-section
Otherwise intermediate section switches result in inconsistent behavior. Note, however, that intermediate sub-section switches will continue to result in inconsistent or even inappropriate behavior. While there also add recording of state to s_insn().
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/i386.exp11
-rw-r--r--gas/testsuite/gas/i386/lfence-section.d19
-rw-r--r--gas/testsuite/gas/i386/lfence-section.e3
-rw-r--r--gas/testsuite/gas/i386/lfence-section.s19
4 files changed, 52 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 6ab1970..2c2543d 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -642,6 +642,17 @@ if [gas_32_check] then {
run_dump_test "lfence-ret-c"
run_dump_test "lfence-ret-d"
run_dump_test "lfence-byte"
+ # This test uses the .section directive, which only ELF and COFF/PE support.
+ if {[is_elf_format]
+ || [istarget "*-*-vxworks*"]
+ || [istarget "*-*-coff*"]
+ || [istarget "*-*-pe*"]
+ || [istarget "*-*-cygwin*"]
+ || [istarget "*-*-mingw*"]
+ } then {
+ run_dump_test "lfence-section"
+ }
+
run_dump_test "branch"
# These tests require support for 8 and 16 bit relocs,
diff --git a/gas/testsuite/gas/i386/lfence-section.d b/gas/testsuite/gas/i386/lfence-section.d
new file mode 100644
index 0000000..830851c
--- /dev/null
+++ b/gas/testsuite/gas/i386/lfence-section.d
@@ -0,0 +1,19 @@
+#as: -mlfence-before-indirect-branch=all
+#warning_output: lfence-section.e
+#objdump: -dw
+#name: -mlfence-before-indirect-branch=all w/ section switches
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: f3 ff d0 repz call \*%eax
+ +[a-f0-9]+: f3 c3 repz ret
+ +[a-f0-9]+: cc int3
+ +[a-f0-9]+: cc int3
+ +[a-f0-9]+: cc int3
+
+Disassembly of section \.text2:
+#pass
diff --git a/gas/testsuite/gas/i386/lfence-section.e b/gas/testsuite/gas/i386/lfence-section.e
new file mode 100644
index 0000000..47f5b2b
--- /dev/null
+++ b/gas/testsuite/gas/i386/lfence-section.e
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*:3: Warning: `rep` skips -mlfence-before-indirect-branch on `call`
+.*:11: Warning: `rep` skips -mlfence-before-ret on `ret`
diff --git a/gas/testsuite/gas/i386/lfence-section.s b/gas/testsuite/gas/i386/lfence-section.s
new file mode 100644
index 0000000..bc3dd0b
--- /dev/null
+++ b/gas/testsuite/gas/i386/lfence-section.s
@@ -0,0 +1,19 @@
+ .text
+_start:
+ rep
+
+ .section .text2, "ax"
+aux1:
+ nop
+
+ .text
+ call *%eax
+ rep
+
+ .section .text2, "ax"
+aux2:
+ nop
+
+ .text
+ ret
+ .p2align 2, 0xcc