aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-06-07 08:49:33 +0200
committerJan Beulich <jbeulich@suse.com>2021-06-07 08:49:33 +0200
commita442cac5084e97d47223bac61cfc4d168c568ba4 (patch)
treea4c81ccccf7d2bb5a3582d462dfc063f0585a642 /gas/testsuite
parent6bee34a1dc94dcfbf84b6318a731e6b059b39977 (diff)
downloadgdb-a442cac5084e97d47223bac61cfc4d168c568ba4.zip
gdb-a442cac5084e97d47223bac61cfc4d168c568ba4.tar.gz
gdb-a442cac5084e97d47223bac61cfc4d168c568ba4.tar.bz2
ix86: wrap constants
Non-64-bit code should get handled the same with or without BFD64. This wasn't the case though in a number of situations (and quite likely there are more that I haven't spotted yet). It's not very nice to tie the check in md_apply_fix() to object_64bit, but afaict at that time we have no record anymore of the mode an insn was assembled in (it might also have been data). This doesn't look to be the first inconsistency of this kind, though. In x86_cons() it's even less clear what the right approach would be: flag_code shouldn't matter for data emission, but instead we'd need to know from which mode(s) the data actually gets accessed. On this basis, signed_cons() also gets adjusted.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
-rw-r--r--gas/testsuite/gas/i386/wrap32-data.d23
-rw-r--r--gas/testsuite/gas/i386/wrap32-text.d43
-rw-r--r--gas/testsuite/gas/i386/wrap32.s60
4 files changed, 128 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index a459c6f..efcccaf 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -148,6 +148,8 @@ if [gas_32_check] then {
run_dump_test "addr32"
run_dump_test "code16"
run_list_test "oversized16" "-al"
+ run_dump_test "wrap32-text"
+ run_dump_test "wrap32-data"
run_dump_test "sse4_1"
run_dump_test "sse4_1-intel"
run_dump_test "sse4_2"
diff --git a/gas/testsuite/gas/i386/wrap32-data.d b/gas/testsuite/gas/i386/wrap32-data.d
new file mode 100644
index 0000000..bebec98
--- /dev/null
+++ b/gas/testsuite/gas/i386/wrap32-data.d
@@ -0,0 +1,23 @@
+#name: i386 32-bit wrapping calculations (data/ELF)
+#source: wrap32.s
+#objdump: -rsj .data
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.data\]:
+
+OFFSET +TYPE +VALUE *
+0*10 (R_386_32|dir32) *sym
+0*14 (R_386_32|dir32) *sym
+0*18 (R_386_32|dir32) *sym
+0*1c (R_386_32|dir32) *sym
+0*30 (R_386_32|dir32) *sym
+0*34 (R_386_32|dir32) *sym
+0*38 (R_386_32|dir32) *sym
+0*3c (R_386_32|dir32) *sym
+
+Contents of section .data:
+ 0+00 f4 ?00 ?00 ?00 f4 ?00 ?00 ?00 90 ?00 ?00 ?00 90 ?00 ?00 ?00 .*
+ 0+10 00 ?ff ?ff ?ff 00 ?ff ?ff ?ff f4 ?00 ?00 ?00 f4 ?00 ?00 ?00 .*
+ 0+20 f4 ?02 ?00 ?70 f4 ?00 ?00 ?80 90 ?02 ?00 ?70 90 ?00 ?00 ?80 .*
+ 0+30 00 ?01 ?00 ?70 00 ?ff ?ff ?7f f4 ?02 ?00 ?70 f4 ?00 ?00 ?80 .*
diff --git a/gas/testsuite/gas/i386/wrap32-text.d b/gas/testsuite/gas/i386/wrap32-text.d
new file mode 100644
index 0000000..3ebbd85
--- /dev/null
+++ b/gas/testsuite/gas/i386/wrap32-text.d
@@ -0,0 +1,43 @@
+#name: i386 32-bit wrapping calculations (text)
+#source: wrap32.s
+#objdump: -dwr
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <wrap>:
+[ ]*[0-9a-f]+:[ ]+b8 f4 00 00 00 mov \$0xf4,%eax
+[ ]*[0-9a-f]+:[ ]+ba f4 00 00 00 mov \$0xf4,%edx
+[ ]*[0-9a-f]+:[ ]+b8 90 00 00 00 mov \$0x90,%eax
+[ ]*[0-9a-f]+:[ ]+ba 90 00 00 00 mov \$0x90,%edx
+[ ]*[0-9a-f]+:[ ]+b8 00 ff ff ff mov \$0xffffff00,%eax[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+ba 00 ff ff ff mov \$0xffffff00,%edx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+b8 f4 00 00 00 mov \$0xf4,%eax[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+ba f4 00 00 00 mov \$0xf4,%edx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+c7 00 f4 00 00 00 movl \$0xf4,\(%eax\)
+[ ]*[0-9a-f]+:[ ]+c7 02 f4 00 00 00 movl \$0xf4,\(%edx\)
+[ ]*[0-9a-f]+:[ ]+c7 00 90 00 00 00 movl \$0x90,\(%eax\)
+[ ]*[0-9a-f]+:[ ]+c7 02 90 00 00 00 movl \$0x90,\(%edx\)
+[ ]*[0-9a-f]+:[ ]+c7 00 00 ff ff ff movl \$0xffffff00,\(%eax\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+c7 02 00 ff ff ff movl \$0xffffff00,\(%edx\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+c7 00 f4 00 00 00 movl \$0xf4,\(%eax\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+c7 02 f4 00 00 00 movl \$0xf4,\(%edx\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 c1 f4 00 00 00 add \$0xf4,%ecx
+[ ]*[0-9a-f]+:[ ]+81 c2 f4 00 00 00 add \$0xf4,%edx
+[ ]*[0-9a-f]+:[ ]+81 c1 90 00 00 00 add \$0x90,%ecx
+[ ]*[0-9a-f]+:[ ]+81 c2 90 00 00 00 add \$0x90,%edx
+[ ]*[0-9a-f]+:[ ]+81 c1 00 ff ff ff add \$0xffffff00,%ecx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 c2 00 ff ff ff add \$0xffffff00,%edx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 c1 f4 00 00 00 add \$0xf4,%ecx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 c2 f4 00 00 00 add \$0xf4,%edx[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 00 f4 00 00 00 addl \$0xf4,\(%eax\)
+[ ]*[0-9a-f]+:[ ]+81 02 f4 00 00 00 addl \$0xf4,\(%edx\)
+[ ]*[0-9a-f]+:[ ]+81 00 90 00 00 00 addl \$0x90,\(%eax\)
+[ ]*[0-9a-f]+:[ ]+81 02 90 00 00 00 addl \$0x90,\(%edx\)
+[ ]*[0-9a-f]+:[ ]+81 00 00 ff ff ff addl \$0xffffff00,\(%eax\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 02 00 ff ff ff addl \$0xffffff00,\(%edx\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 00 f4 00 00 00 addl \$0xf4,\(%eax\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+81 02 f4 00 00 00 addl \$0xf4,\(%edx\)[ ]+[0-9a-f]+: (R_386_32|dir32)[ ]+sym
+[ ]*[0-9a-f]+:[ ]+c3 ret *
+#pass
diff --git a/gas/testsuite/gas/i386/wrap32.s b/gas/testsuite/gas/i386/wrap32.s
new file mode 100644
index 0000000..0198484
--- /dev/null
+++ b/gas/testsuite/gas/i386/wrap32.s
@@ -0,0 +1,60 @@
+ .text
+wrap:
+ mov $500 - 0x100, %eax
+ mov $500 + 0xffffff00, %edx
+ mov $val - 0x100, %eax
+ mov $val + 0xffffff00, %edx
+ mov $sym - 0x100, %eax
+ mov $sym + 0xffffff00, %edx
+ mov $sym + 500 - 0x100, %eax
+ mov $sym + 500 + 0xffffff00, %edx
+
+ movl $500 - 0x100, (%eax)
+ movl $500 + 0xffffff00, (%edx)
+ movl $val - 0x100, (%eax)
+ movl $val + 0xffffff00, (%edx)
+ movl $sym - 0x100, (%eax)
+ movl $sym + 0xffffff00, (%edx)
+ movl $sym + 500 - 0x100, (%eax)
+ movl $sym + 500 + 0xffffff00, (%edx)
+
+ add $500 - 0x100, %ecx
+ add $500 + 0xffffff00, %edx
+ add $val - 0x100, %ecx
+ add $val + 0xffffff00, %edx
+ add $sym - 0x100, %ecx
+ add $sym + 0xffffff00, %edx
+ add $sym + 500 - 0x100, %ecx
+ add $sym + 500 + 0xffffff00, %edx
+
+ addl $500 - 0x100, (%eax)
+ addl $500 + 0xffffff00, (%edx)
+ addl $val - 0x100, (%eax)
+ addl $val + 0xffffff00, (%edx)
+ addl $sym - 0x100, (%eax)
+ addl $sym + 0xffffff00, (%edx)
+ addl $sym + 500 - 0x100, (%eax)
+ addl $sym + 500 + 0xffffff00, (%edx)
+
+ ret
+
+ .data
+ .long 500 - 0x100
+ .long 500 + 0xffffff00
+ .long val - 0x100
+ .long val + 0xffffff00
+ .long sym - 0x100
+ .long sym + 0xffffff00
+ .long sym + 500 - 0x100
+ .long sym + 500 + 0xffffff00
+
+ .slong 500 - 0x8fffff00
+ .slong 500 + 0x7fffff00
+ .slong val - 0x8fffff00
+ .slong val + 0x7fffff00
+ .slong sym - 0x8fffff00
+ .slong sym + 0x7fffff00
+ .slong sym + 500 - 0x8fffff00
+ .slong sym + 500 + 0x7fffff00
+
+ .equ val, 400