aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2020-11-14 06:16:26 -0800
committerH.J. Lu <hjl.tools@gmail.com>2020-11-14 06:20:33 -0800
commit0fa0fc8539f4451bd1ed76867ba87a335e28ff31 (patch)
treec010ef4ef967a84d7726f9d1b7f6231350e1e22c /ld
parente8b2f0d952184fac8a230db181a4b9810729cd7b (diff)
downloadgdb-0fa0fc8539f4451bd1ed76867ba87a335e28ff31.zip
gdb-0fa0fc8539f4451bd1ed76867ba87a335e28ff31.tar.gz
gdb-0fa0fc8539f4451bd1ed76867ba87a335e28ff31.tar.bz2
x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode
"In 64-bit mode, the CS, DS, ES, and SS segment-override prefixes have no effect. These four prefixes are not treated as segment-override prefixes for the purposes of multiple-prefix rules. Instead, they are treated as null prefixes." (AMD APM v2). However, objdump disassembles instructions containing those ignored prefixes by still generating that segment override: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1) 00 00 00 00 Print those segment override prefixes as excessive ones: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1) 00 00 00 00 which is what they actually are - they have no effect and the decoding hardware ignores them. gas/ 2020-11-14 Borislav Petkov <bp@suse.de> * testsuite/gas/i386/x86-64-segovr.d: Adjust regexes. * testsuite/gas/i386/x86-64-nops.d: Likewise. * testsuite/gas/i386/x86-64-nops-1.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-2.d: Likewise. * testsuite/gas/i386/x86-64-nops-3.d: Likewise. * testsuite/gas/i386/x86-64-nops-4.d: Likewise. * testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise. * testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-5.d: Likewise. * testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-7.d: Likewise. * testsuite/gas/i386/x86-64-nop-1.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-6.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops.d:: Likewise. ld/ 2020-11-14 Borislav Petkov <bp@suse.de> * testsuite/ld-x86-64/pe-x86-64-4.od: Adjust regexes. * testsuite/ld-x86-64/tlsld3.dd: Likewise. * testsuite/ld-x86-64/tlsld4.dd: Likewise. opcodes/ 2020-11-14 Borislav Petkov <bp@suse.de> * i386-dis.c (ckprefix): Do not assign active_seg_prefix in 64-bit addressing mode. (NOTRACK_Fixup): Test prefixes for PREFIX_DS, instead of active_seg_prefix.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-x86-64/align-branch-1.d2
-rw-r--r--ld/testsuite/ld-x86-64/pe-x86-64-4.od2
-rw-r--r--ld/testsuite/ld-x86-64/tlsld3.dd2
-rw-r--r--ld/testsuite/ld-x86-64/tlsld4.dd2
5 files changed, 10 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 70ea14b..2ae5b487 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-14 Borislav Petkov <bp@suse.de>
+
+ * testsuite/ld-x86-64/pe-x86-64-4.od: Adjust regexes.
+ * testsuite/ld-x86-64/tlsld3.dd: Likewise.
+ * testsuite/ld-x86-64/tlsld4.dd: Likewise.
+
2020-11-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26869
diff --git a/ld/testsuite/ld-x86-64/align-branch-1.d b/ld/testsuite/ld-x86-64/align-branch-1.d
index 19ac6a8..b517365 100644
--- a/ld/testsuite/ld-x86-64/align-branch-1.d
+++ b/ld/testsuite/ld-x86-64/align-branch-1.d
@@ -13,7 +13,7 @@ Disassembly of section .text:
+[a-f0-9]+: 48 85 ff test %rdi,%rdi
+[a-f0-9]+: 74 1c je [a-f0-9]+ <_start\+0x25>
+[a-f0-9]+: 66 66 66 64 48 8b 04 25 00 00 00 00 data16 data16 data16 mov %fs:0x0,%rax
- +[a-f0-9]+: 2e 2e 2e 2e 48 8b 98 fc ff ff ff cs cs cs mov %cs:-0x4\(%rax\),%rbx
+ +[a-f0-9]+: 2e 2e 2e 2e 48 8b 98 fc ff ff ff cs cs cs cs mov -0x4\(%rax\),%rbx
+[a-f0-9]+: 48 85 db test %rbx,%rbx
+[a-f0-9]+: 74 00 je [a-f0-9]+ <_start\+0x25>
+[a-f0-9]+: c3 ret *
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-4.od b/ld/testsuite/ld-x86-64/pe-x86-64-4.od
index e8940ba..302a345 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64-4.od
+++ b/ld/testsuite/ld-x86-64/pe-x86-64-4.od
@@ -39,7 +39,7 @@ Disassembly of section .text\$mn:
+[a-f0-9]+: 83 c8 ff or \$0xffffffff,%eax
+[a-f0-9]+: c7 05 cb 1f 00 00 55 55 44 44 movl \$0x44445555,0x1fcb\(%rip\) # 40301c <Struct\+0x4>
+[a-f0-9]+: c3 ret
- +[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 cs nopw 0x0\(%rax,%rax,1\)
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
0+401060 <opti_Od>:
diff --git a/ld/testsuite/ld-x86-64/tlsld3.dd b/ld/testsuite/ld-x86-64/tlsld3.dd
index 75ac2bf..25310b0 100644
--- a/ld/testsuite/ld-x86-64/tlsld3.dd
+++ b/ld/testsuite/ld-x86-64/tlsld3.dd
@@ -14,7 +14,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 53 push %rbx
[ ]*[a-f0-9]+: 48 8d 1d ed ff ff ff lea -0x13\(%rip\),%rbx # [0-9a-f]+ <_start>
[ ]*[a-f0-9]+: 4c 01 db add %r11,%rbx
-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\)
+[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 cs nopw 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 64 48 8b 04 25 00 00 00 00 mov %fs:0x0,%rax
[ ]*[a-f0-9]+: 8b 80 fc ff ff ff mov -0x4\(%rax\),%eax
[ ]*[a-f0-9]+: 5b pop %rbx
diff --git a/ld/testsuite/ld-x86-64/tlsld4.dd b/ld/testsuite/ld-x86-64/tlsld4.dd
index 711f507..bf5602e 100644
--- a/ld/testsuite/ld-x86-64/tlsld4.dd
+++ b/ld/testsuite/ld-x86-64/tlsld4.dd
@@ -14,7 +14,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 41 57 push %r15
[ ]*[a-f0-9]+: 4c 8d 3d eb ff ff ff lea -0x15\(%rip\),%r15 # [0-9a-f]+ <_start>
[ ]*[a-f0-9]+: 4d 01 df add %r11,%r15
-[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 nopw %cs:0x0\(%rax,%rax,1\)
+[ ]*[a-f0-9]+: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 data16 data16 data16 cs nopw 0x0\(%rax,%rax,1\)
[ ]*[a-f0-9]+: 64 48 8b 04 25 00 00 00 00 mov %fs:0x0,%rax
[ ]*[a-f0-9]+: 8b 80 fc ff ff ff mov -0x4\(%rax\),%eax
[ ]*[a-f0-9]+: 41 5f pop %r15