summaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-07-04 08:31:21 +0200
committerJan Beulich <jbeulich@suse.com>2022-07-04 08:31:21 +0200
commit9386188e95f4dee6319c51b30e2ea64b27ae0084 (patch)
treeec9a18337ec0f2d2193f78c0eddc0fc2b9d9674a /gas/testsuite
parent0f2f2e7019f6c3415069a5bf5f47064d45d87571 (diff)
x86-64: improve handling of branches to absolute addresses
There are two related problems here: The use of "addr32" on a direct branch would, besides causing a warning, result in operands to be permitted which mistakenly are refused without "addr32". Plus at some point not too long ago I'm afraid it may have been me who regressed the relocation addends emitted for such branches. Correct both problems, adding a testcase to guard against regressing this again.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
-rw-r--r--gas/testsuite/gas/i386/x86-64-branch-6.d21
-rw-r--r--gas/testsuite/gas/i386/x86-64-branch-6.e7
-rw-r--r--gas/testsuite/gas/i386/x86-64-branch-6.s18
4 files changed, 47 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index a4fc5b4096..ebb1b49246 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1314,6 +1314,7 @@ if [gas_64_check] then {
run_dump_test "x86-64-branch-3"
run_list_test "x86-64-branch-4" "-al -mintel64"
run_list_test "x86-64-branch-5" "-al"
+ run_dump_test "x86-64-branch-6"
run_dump_test "x86-64-rip-2"
diff --git a/gas/testsuite/gas/i386/x86-64-branch-6.d b/gas/testsuite/gas/i386/x86-64-branch-6.d
new file mode 100644
index 0000000000..a2d388f127
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-branch-6.d
@@ -0,0 +1,21 @@
+#objdump: -r
+#name: x86-64 branch 6
+#warning_output: x86-64-branch-6.e
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET +TYPE +VALUE *
+0+01 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+11 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+21 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+31 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+07 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+0c R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+17 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+1c R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+27 R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+2c R_X86_64_PC32 +\*ABS\*\+0x000000008765431d
+0+37 R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+0+3c R_X86_64_PC32 +\*ABS\*\+0x000000087654320c
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-branch-6.e b/gas/testsuite/gas/i386/x86-64-branch-6.e
new file mode 100644
index 0000000000..1dc58ea11c
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-branch-6.e
@@ -0,0 +1,7 @@
+.*: Assembler messages:
+.*:12: Warning: skipping prefixes on `call'
+.*:13: Warning: skipping prefixes on `je'
+.*:14: Warning: skipping prefixes on `jmp'
+.*:16: Warning: skipping prefixes on `call'
+.*:17: Warning: skipping prefixes on `je'
+.*:18: Warning: skipping prefixes on `jmp'
diff --git a/gas/testsuite/gas/i386/x86-64-branch-6.s b/gas/testsuite/gas/i386/x86-64-branch-6.s
new file mode 100644
index 0000000000..a5b108e5ab
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-branch-6.s
@@ -0,0 +1,18 @@
+ .text
+
+branch_6:
+ call 0x87654321
+ je 0x87654321
+ jmp 0x87654321
+
+ call 0x876543210
+ je 0x876543210
+ jmp 0x876543210
+
+ addr32 call 0x87654321
+ addr32 je 0x87654321
+ addr32 jmp 0x87654321
+
+ addr32 call 0x876543210
+ addr32 je 0x876543210
+ addr32 jmp 0x876543210