x86: Do not dump DS/CS segment overrides for branch hints

I've made all labels normal labels so that there's no confusion between
the different targets which is which and I match them in the .d files
with .* as Alan suggested.

Hex offsets I match with [0-9a-fx]+ since some targets prefix them with
0x, some don't, etc.

	* testsuite/gas/i386/align-branch-9.s: Don't use labels that are
	automatically local for ELF targets.
	* testsuite/gas/i386/branch.s: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-9.s: Likewise.
	* testsuite/gas/i386/x86-64-branch.s: Likewise.
	* testsuite/gas/i386/align-branch-9.d: Adjust to match more targets.
	* testsuite/gas/i386/branch.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-9.d: Likewise.
	* testsuite/gas/i386/x86-64-branch.d: Likewise.
This commit is contained in:
Borislav Petkov
2020-12-12 00:12:24 +01:00
committed by Alan Modra
parent 77e890c695
commit 7393df7f3f
10 changed files with 82 additions and 60 deletions

View File

@ -1,3 +1,16 @@
2020-12-13 Borislav Petkov <bp@suse.de>
* testsuite/gas/i386/align-branch-9.s: Don't use labels that are
automatically local for ELF targets.
* testsuite/gas/i386/branch.s: Likewise.
* testsuite/gas/i386/x86-64-align-branch-9.s: Likewise.
* testsuite/gas/i386/x86-64-branch.s: Likewise.
* testsuite/gas/i386/align-branch-9.d: Adjust to match more targets.
* testsuite/gas/i386/branch.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-9.d: Likewise.
* testsuite/gas/i386/x86-64-branch.d: Likewise.
2020-12-11 Sergey Belyashov <sergey.belyashov@gmail.com>
Nick Clifton <nickc@redhat.com>

View File

@ -19,7 +19,7 @@ Disassembly of section .text:
18: 89 75 f4 mov %esi,-0xc\(%ebp\)
1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
1e: 39 c5 cmp %eax,%ebp
20: 70 62 jo 84 <foo\+0x84>
20: 70 62 jo 84 <.*>
22: 89 73 f4 mov %esi,-0xc\(%ebx\)
25: 89 75 f4 mov %esi,-0xc\(%ebp\)
28: 89 7d f8 mov %edi,-0x8\(%ebp\)
@ -31,9 +31,9 @@ Disassembly of section .text:
3a: 5d pop %ebp
3b: 5d pop %ebp
3c: 5d pop %ebp
3d: 74 45 je 84 <foo\+0x84>
3d: 74 45 je 84 <.*>
3f: 5d pop %ebp
40: 74 42 je 84 <foo\+0x84>
40: 74 42 je 84 <.*>
42: 89 44 24 fc mov %eax,-0x4\(%esp\)
46: 89 75 f4 mov %esi,-0xc\(%ebp\)
49: 89 7d f8 mov %edi,-0x8\(%ebp\)
@ -43,25 +43,27 @@ Disassembly of section .text:
55: 89 75 f4 mov %esi,-0xc\(%ebp\)
58: 89 75 f4 mov %esi,-0xc\(%ebp\)
5b: 5d pop %ebp
5c: eb 2c jmp 8a <foo\+0x8a>
5c: eb 2c jmp 8a <.*>
5e: 66 90 xchg %ax,%ax
60: eb 28 jmp 8a <foo\+0x8a>
62: eb 26 jmp 8a <foo\+0x8a>
60: eb 28 jmp 8a <.*>
62: eb 26 jmp 8a <.*>
64: 89 45 fc mov %eax,-0x4\(%ebp\)
67: 89 75 f4 mov %esi,-0xc\(%ebp\)
6a: 89 7d f8 mov %edi,-0x8\(%ebp\)
6d: 5d pop %ebp
6e: 5d pop %ebp
6f: 40 inc %eax
70: 72 12 jb 84 <foo\+0x84>
70: 72 12 jb 84 <.*>
72: 36 36 89 45 fc ss mov %eax,%ss:-0x4\(%ebp\)
77: 89 75 f4 mov %esi,-0xc\(%ebp\)
7a: 89 7d f8 mov %edi,-0x8\(%ebp\)
7d: 89 75 f4 mov %esi,-0xc\(%ebp\)
80: 21 c3 and %eax,%ebx
82: 7c 06 jl 8a <foo\+0x8a>
82: 7c 06 jl 8a <.*>
00000084 <label2>:
84: 8b 45 f4 mov -0xc\(%ebp\),%eax
87: 89 45 fc mov %eax,-0x4\(%ebp\)
0000008a <label3>:
8a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
90: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
96: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
@ -73,6 +75,6 @@ Disassembly of section .text:
b6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
bc: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
c2: 89 75 00 mov %esi,0x0\(%ebp\)
c5: 74 c3 je 8a <foo\+0x8a>
c7: 74 c1 je 8a <foo\+0x8a>
c5: 74 c3 je 8a <.*>
c7: 74 c1 je 8a <.*>
#pass

View File

@ -15,7 +15,7 @@ foo:
movl %esi, -12(%ebp)
movl %esi, -12(%ebp)
cmp %eax, %ebp
jo .L_2
jo label2
movl %esi, -12(%ebx)
movl %esi, -12(%ebp)
movl %edi, -8(%ebp)
@ -27,9 +27,9 @@ foo:
popl %ebp
popl %ebp
popl %ebp
je .L_2
je label2
popl %ebp
je .L_2
je label2
movl %eax, -4(%esp)
movl %esi, -12(%ebp)
movl %edi, -8(%ebp)
@ -39,26 +39,26 @@ foo:
movl %esi, -12(%ebp)
movl %esi, -12(%ebp)
popl %ebp
jmp .L_3
jmp .L_3
jmp .L_3
jmp label3
jmp label3
jmp label3
movl %eax, -4(%ebp)
movl %esi, -12(%ebp)
movl %edi, -8(%ebp)
popl %ebp
popl %ebp
inc %eax
jc .L_2
jc label2
movl %eax, -4(%ebp)
movl %esi, -12(%ebp)
movl %edi, -8(%ebp)
movl %esi, -12(%ebp)
and %eax, %ebx
jl .L_3
.L_2:
jl label3
label2:
movl -12(%ebp), %eax
movl %eax, -4(%ebp)
.L_3:
label3:
movl %esi, -1200(%ebp)
movl %esi, -1200(%ebp)
movl %esi, -1200(%ebp)
@ -70,5 +70,5 @@ foo:
movl %esi, -1200(%ebp)
movl %esi, -1200(%ebp)
movl %esi, (%ebp)
je .L_3
je .L_3
je label3
je label3

View File

@ -6,7 +6,7 @@
Disassembly of section .text:
0+ <.text>:
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +0x[0-9a-f]+
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +0x[0-9a-f]+
0+ <.*>:
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +[0-9a-fx]+ <.*>
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +[0-9a-fx]+ <.*>
#pass

View File

@ -1,4 +1,4 @@
.text
jz,pt .Llabel
jz,pn .Llabel
.Llabel:
jz,pt label
jz,pn label
label:

View File

@ -7,7 +7,7 @@
Disassembly of section .text:
0+ <.text>:
[0-9a-f]+ <.*>:
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: 66 ff d0 data16 call \*%rax
@ -18,15 +18,16 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff 20 data16 jmp \*\(%rax\)
[ ]*[a-f0-9]+: e8 00 00 00 00 call 0x1f 1b: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 0x24 20: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call 0x2a 26: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp 0x30 2c: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb 0x37 33: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: e8 00 00 00 00 call (0x)?1f <.*> 1b: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp (0x)?24 <.*> 20: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call (0x)?2a <.*> 26: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp (0x)?30 <.*> 2c: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb (0x)?37 <.*> 33: R_X86_64_PLT32 foo-0x4
[ ]*[a-f0-9]+: 66 c3 data16 ret *
[ ]*[a-f0-9]+: 66 c2 08 00 data16 ret \$0x8
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +0x[0-9a-f]+
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +0x[0-9a-f]+
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +[0-9a-fx]+ <.*>
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +[0-9a-fx]+ <.*>
[0-9a-f]+ <.*>:
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: 66 ff d0 data16 call \*%rax
@ -37,8 +38,8 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff 20 data16 jmp \*\(%rax\)
[ ]*[a-f0-9]+: e8 00 00 00 00 call 0x[0-9a-f]* [0-9a-f]*: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 0x[0-9a-f]* [0-9a-f]*: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e8 00 00 00 00 call [0-9a-fx]* <.*> [0-9a-f]*: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp [0-9a-fx]* <.*> [0-9a-f]*: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: 66 c3 data16 ret *
[ ]*[a-f0-9]+: 66 c2 08 00 data16 ret \$0x8
#pass

View File

@ -7,6 +7,7 @@ Disassembly of section .text:
0+ <foo>:
0: c1 e9 02 shr \$0x2,%ecx
[0-9a-f]+ <.*>:
3: c1 e9 02 shr \$0x2,%ecx
6: c1 e9 02 shr \$0x2,%ecx
9: 89 d1 mov %edx,%ecx
@ -18,9 +19,11 @@ Disassembly of section .text:
19: c1 e9 02 shr \$0x2,%ecx
1c: c1 e9 02 shr \$0x2,%ecx
1f: 80 fa 02 cmp \$0x2,%dl
22: 70 df jo 3 <foo\+0x3>
22: 70 df jo [0-9a-fx]+ <.*>
24: 2e 2e 2e 2e 31 c0 cs cs cs cs xor %eax,%eax
2a: c1 e9 02 shr \$0x2,%ecx
[0-9a-f]+ <.*>:
2d: c1 e9 02 shr \$0x2,%ecx
30: c1 e9 02 shr \$0x2,%ecx
33: 89 d1 mov %edx,%ecx
@ -29,8 +32,10 @@ Disassembly of section .text:
3a: c1 e9 02 shr \$0x2,%ecx
3d: c1 e9 02 shr \$0x2,%ecx
40: f6 c2 02 test \$0x2,%dl
43: 75 e8 jne 2d <foo\+0x2d>
43: 75 e8 jne [0-9a-fx]+ <.*>
45: 31 c0 xor %eax,%eax
[0-9a-f]+ <.*>:
47: c1 e9 02 shr \$0x2,%ecx
4a: c1 e9 02 shr \$0x2,%ecx
4d: 89 d1 mov %edx,%ecx
@ -41,6 +46,6 @@ Disassembly of section .text:
5a: 89 d1 mov %edx,%ecx
5c: 31 c0 xor %eax,%eax
5e: ff c0 inc %eax
60: 76 cb jbe 2d <foo\+0x2d>
60: 76 cb jbe [0-9a-fx]+ <.*>
62: 31 c0 xor %eax,%eax
#pass

View File

@ -2,7 +2,7 @@
.p2align 4,,15
foo:
shrl $2, %ecx
.L1:
l1:
shrl $2, %ecx
shrl $2, %ecx
movl %edx, %ecx
@ -14,10 +14,10 @@ foo:
shrl $2, %ecx
shrl $2, %ecx
cmpb $2, %dl
jo .L1
jo l1
xorl %eax, %eax
shrl $2, %ecx
.L2:
l2:
shrl $2, %ecx
shrl $2, %ecx
movl %edx, %ecx
@ -26,9 +26,9 @@ foo:
shrl $2, %ecx
shrl $2, %ecx
testb $2, %dl
jne .L2
jne l2
xorl %eax, %eax
.L3:
l3:
shrl $2, %ecx
shrl $2, %ecx
movl %edx, %ecx
@ -39,5 +39,5 @@ foo:
movl %edx, %ecx
xorl %eax, %eax
inc %eax
jbe .L2
jbe l2
xorl %eax, %eax

View File

@ -6,7 +6,7 @@
Disassembly of section .text:
0+ <.text>:
[0-9a-f]+ <.*>:
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: 66 ff d0 data16 call \*%rax
@ -17,15 +17,16 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff 20 data16 jmp \*\(%rax\)
[ ]*[a-f0-9]+: e8 (00|5b) 00 (00|10) 00 call (0x1f|10007a <.text\+0x10007a>)
[ ]*[a-f0-9]+: e9 (00|60) 00 (00|10) 00 jmp (0x24|100084 <.text\+0x100084>)
[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call (0x2a|2a <.text\+0x2a>)
[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp (0x30|30 <.text\+0x30>)
[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb (0x37|37 <.text\+0x37>)
[ ]*[a-f0-9]+: e8 (00|5b) 00 (00|10) 00 call ((0x)?1f|10007a) <.*>
[ ]*[a-f0-9]+: e9 (00|60) 00 (00|10) 00 jmp ((0x)?24|100084) <.*>
[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call (0x2a|2a <.*>)
[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp (0x30|30 <.*>)
[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb (0x37|37 <.*>)
[ ]*[a-f0-9]+: 66 c3 data16 ret *
[ ]*[a-f0-9]+: 66 c2 08 00 data16 ret \$0x8
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +0x[0-9a-f]+
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +0x[0-9a-f]+
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +[0-9a-fx]+ <.*>
[ ]*[a-f0-9]+: 2e 74 00[ ]+je,pn +[0-9a-fx]+ <.*>
[0-9a-f]+ <label>:
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: ff d0 call \*%rax
[ ]*[a-f0-9]+: 66 ff d0 data16 call \*%rax
@ -36,8 +37,8 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff e0 data16 jmp \*%rax
[ ]*[a-f0-9]+: 66 ff 20 data16 jmp \*\(%rax\)
[ ]*[a-f0-9]+: e8 .. 00 (00|10) 00 call (0x[0-9a-f]*|100[0-9a-f]* <.text\+0x100[0-9a-f]*>)
[ ]*[a-f0-9]+: e9 .. 00 (00|10) 00 jmp (0x[0-9a-f]*|100[0-9a-f]* <.text\+0x100[0-9a-f]*>)
[ ]*[a-f0-9]+: e8 .. 00 (00|10) 00 call [0-9a-fx]* <.*>
[ ]*[a-f0-9]+: e9 .. 00 (00|10) 00 jmp [0-9a-fx]* <.*>
[ ]*[a-f0-9]+: 66 c3 data16 ret *
[ ]*[a-f0-9]+: 66 c2 08 00 data16 ret \$0x8
#pass

View File

@ -22,9 +22,9 @@
retw
retw $8
jz,pt .Llabel
jz,pn .Llabel
.Llabel:
jz,pt label
jz,pn label
label:
.intel_syntax noprefix
call rax