public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: x86: Do not dump DS/CS segment overrides for branch hints
@ 2020-12-02  7:19 Alan Modra
  2020-12-02  9:44 ` Borislav Petkov
  2020-12-02 10:45 ` Borislav Petkov
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Modra @ 2020-12-02  7:19 UTC (permalink / raw)
  To: binutils; +Cc: Borislav Petkov

i386-bsd  +FAIL: i386 branch
i386-darwin  +FAIL: i386 branch
i386-darwin  +FAIL: x86-64 branch
i386-msdos  +FAIL: i386 branch
x86_64-w64-mingw32  +FAIL: x86-64 branch

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-02  7:19 x86: Do not dump DS/CS segment overrides for branch hints Alan Modra
@ 2020-12-02  9:44 ` Borislav Petkov
  2020-12-02 10:45 ` Borislav Petkov
  1 sibling, 0 replies; 10+ messages in thread
From: Borislav Petkov @ 2020-12-02  9:44 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

Hi Alan,

On Wed, Dec 02, 2020 at 05:49:55PM +1030, Alan Modra wrote:
> i386-bsd  +FAIL: i386 branch
> i386-darwin  +FAIL: i386 branch
> i386-darwin  +FAIL: x86-64 branch
> i386-msdos  +FAIL: i386 branch
> x86_64-w64-mingw32  +FAIL: x86-64 branch

sorry about that ;-\ (and pls bear with me - I'm still learning the
ropes around here).

All "make check-*" runs pass here so I'd guess the fails above happen
when building some other targets. How do you trigger those failures, so
that I can reproduce and add to my patch testing in the future?

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-02  7:19 x86: Do not dump DS/CS segment overrides for branch hints Alan Modra
  2020-12-02  9:44 ` Borislav Petkov
@ 2020-12-02 10:45 ` Borislav Petkov
  2020-12-02 11:10   ` Borislav Petkov
  1 sibling, 1 reply; 10+ messages in thread
From: Borislav Petkov @ 2020-12-02 10:45 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Wed, Dec 02, 2020 at 05:49:55PM +1030, Alan Modra wrote:
> i386-bsd  +FAIL: i386 branch

Ok, found the first one - that's a --target=i386-bsd build AFAICT.

The first failure I can trigger here is:

FAIL: gas/i386/align-branch-9

Debug output from the test run says:

...
regexp "^  1e:  39 c5                   cmp    %eax,%ebp$"
line   "  1e:   39 c5                   cmp    %eax,%ebp"
regexp "^  20:  70 62                   jo     84 <foo\+0x84>$"
line   "  20:   70 62                   jo     84 <.L_2>"
regexp_diff match failure

because the test has:

  cmp  %eax, %ebp
  jo  .L_2

it disassembles to

  1e:   39 c5                   cmp    %eax,%ebp
  20:   70 62                   jo     84 <.L_2>

but the .d file has

  1e:	39 c5                	cmp    %eax,%ebp
  20:	70 62                	jo     84 <foo\+0x84>

i.e., it has that local label .L_2 instead of the offset foo+0x84.

Now I've checked out master before my patch:

9f1212394fa2 (HEAD -> refs/heads/master, refs/remotes/origin/master, refs/remotes/origin/HEAD) Fix Value.format_string docu for static members argument
96fb90861a4e Don't delete the locator win info
632ee6fd822f x86: Do not dump DS/CS segment overrides for branch hints

<--- HERE

568cbddc710f gold: Convert x86-64 GOTPCRELX only if addend == -4

and it fails the same way.

So I'm thinking for this particular case, I should simply fix
align-branch-9.d to match the local label

	[0-9]+ <.L_2>

because we show local labels now in .o disassembly.

Yes?

> i386-darwin  +FAIL: i386 branch
> i386-darwin  +FAIL: x86-64 branch
> i386-msdos  +FAIL: i386 branch
> x86_64-w64-mingw32  +FAIL: x86-64 branch

I'll analyze the rest later.

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-02 10:45 ` Borislav Petkov
@ 2020-12-02 11:10   ` Borislav Petkov
  2020-12-07 14:15     ` Maciej W. Rozycki
  0 siblings, 1 reply; 10+ messages in thread
From: Borislav Petkov @ 2020-12-02 11:10 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Wed, Dec 02, 2020 at 11:45:19AM +0100, Borislav Petkov wrote:
> So I'm thinking for this particular case, I should simply fix
> align-branch-9.d to match the local label
> 
> 	[0-9]+ <.L_2>
> 
> because we show local labels now in .o disassembly.

Hmm, one more aspect: could it be that local labels are specified
differently for the i386-bsd target?

Because that branch.s test

.text
        jz,pt .Llabel
        jz,pn .Llabel
.Llabel:

dumps on x86_64 as:

00000000 <.text>:
   0:   3e 74 03                je,pt  0x6
   3:   2e 74 00                je,pn  0x6

but the i386-bsd target objdump says:

Disassembly of section .text:

00000000 <.Llabel-0x6>:
   0:   3e 74 03                je,pt  6 <.Llabel>
   3:   2e 74 00                je,pn  6 <.Llabel>

which has the local label name in <>. Leading to the test failure.

So perhaps I should not use local labels...

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-02 11:10   ` Borislav Petkov
@ 2020-12-07 14:15     ` Maciej W. Rozycki
  2020-12-07 22:16       ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Maciej W. Rozycki @ 2020-12-07 14:15 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Alan Modra, binutils

On Wed, 2 Dec 2020, Borislav Petkov wrote:

> > So I'm thinking for this particular case, I should simply fix
> > align-branch-9.d to match the local label
> > 
> > 	[0-9]+ <.L_2>
> > 
> > because we show local labels now in .o disassembly.
> 
> Hmm, one more aspect: could it be that local labels are specified
> differently for the i386-bsd target?

 Sure, this is a non-ELF target and these do tend to do local labels 
differently.  Grep GAS sources for LOCAL_LABEL and refer Section 5.3 
"Symbol Names" in the GAS manual to see what to look for.

 Writing generic test cases that work everywhere can be tricky at times.

  Maciej

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-07 14:15     ` Maciej W. Rozycki
@ 2020-12-07 22:16       ` Alan Modra
  2020-12-07 22:38         ` Borislav Petkov
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Modra @ 2020-12-07 22:16 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: binutils

On Mon, Dec 07, 2020 at 02:15:14PM +0000, Maciej W. Rozycki wrote:
> On Wed, 2 Dec 2020, Borislav Petkov wrote:
> 
> > > So I'm thinking for this particular case, I should simply fix
> > > align-branch-9.d to match the local label
> > > 
> > > 	[0-9]+ <.L_2>
> > > 
> > > because we show local labels now in .o disassembly.
> > 
> > Hmm, one more aspect: could it be that local labels are specified
> > differently for the i386-bsd target?
> 
>  Sure, this is a non-ELF target and these do tend to do local labels 
> differently.  Grep GAS sources for LOCAL_LABEL and refer Section 5.3 
> "Symbol Names" in the GAS manual to see what to look for.
> 
>  Writing generic test cases that work everywhere can be tricky at times.

Yes, on x86 you should at least try one of the PE and AOUT targets as
well as your ELF target.  Question whether the test needs to match
label output.  ".*" past the insn mnemonic might good enough to test
whatever it is you are really testing.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-07 22:16       ` Alan Modra
@ 2020-12-07 22:38         ` Borislav Petkov
  2020-12-11 23:12           ` Borislav Petkov
  0 siblings, 1 reply; 10+ messages in thread
From: Borislav Petkov @ 2020-12-07 22:38 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Tue, Dec 08, 2020 at 08:46:24AM +1030, Alan Modra wrote:
> >  Sure, this is a non-ELF target and these do tend to do local labels 
> > differently.  Grep GAS sources for LOCAL_LABEL and refer Section 5.3 
> > "Symbol Names" in the GAS manual to see what to look for.
> > 
> >  Writing generic test cases that work everywhere can be tricky at times.
> 
> Yes, on x86 you should at least try one of the PE and AOUT targets as
> well as your ELF target. 

Yes, I'll be testing them from now on.

> Question whether the test needs to match label output. ".*" past the
> insn mnemonic might good enough to test whatever it is you are really
> testing.

Ah, cool idea.

I'm working on fixing those test cases and will send a diff soon for you
guys to have a look.

Thank you both.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-07 22:38         ` Borislav Petkov
@ 2020-12-11 23:12           ` Borislav Petkov
  2020-12-13  3:35             ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Borislav Petkov @ 2020-12-11 23:12 UTC (permalink / raw)
  To: Alan Modra, Maciej W. Rozycki; +Cc: binutils

Hi,

ok, below is what I got and it passes the checks.

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.

So pls have a look and let me know whether that makes sense.

Thx.

---
diff --git a/gas/testsuite/gas/i386/align-branch-9.d b/gas/testsuite/gas/i386/align-branch-9.d
index 2d5ceef09b1a..643ca283bc07 100644
--- a/gas/testsuite/gas/i386/align-branch-9.d
+++ b/gas/testsuite/gas/i386/align-branch-9.d
@@ -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
diff --git a/gas/testsuite/gas/i386/align-branch-9.s b/gas/testsuite/gas/i386/align-branch-9.s
index 357abe30f97f..acba220b7a85 100644
--- a/gas/testsuite/gas/i386/align-branch-9.s
+++ b/gas/testsuite/gas/i386/align-branch-9.s
@@ -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
diff --git a/gas/testsuite/gas/i386/branch.d b/gas/testsuite/gas/i386/branch.d
index 6d25b950830f..343544b3757a 100644
--- a/gas/testsuite/gas/i386/branch.d
+++ b/gas/testsuite/gas/i386/branch.d
@@ -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
diff --git a/gas/testsuite/gas/i386/branch.s b/gas/testsuite/gas/i386/branch.s
index 968a1818970f..3a8078957578 100644
--- a/gas/testsuite/gas/i386/branch.s
+++ b/gas/testsuite/gas/i386/branch.s
@@ -1,4 +1,4 @@
 .text
-	jz,pt .Llabel
-	jz,pn .Llabel
-.Llabel:
+	jz,pt label
+	jz,pn label
+label:
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
index d5f2358546fc..acf8c42ca97c 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-9.d b/gas/testsuite/gas/i386/x86-64-align-branch-9.d
index 1041fd048331..35f56ad8ddad 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-9.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-9.d
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-9.s b/gas/testsuite/gas/i386/x86-64-align-branch-9.s
index 917579bda401..59507f8ad26e 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-9.s
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-9.s
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-branch.d b/gas/testsuite/gas/i386/x86-64-branch.d
index b963f9f051e4..02509d21bc33 100644
--- a/gas/testsuite/gas/i386/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/x86-64-branch.d
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-branch.s b/gas/testsuite/gas/i386/x86-64-branch.s
index 496e1bb089fb..75db8f599942 100644
--- a/gas/testsuite/gas/i386/x86-64-branch.s
+++ b/gas/testsuite/gas/i386/x86-64-branch.s
@@ -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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-11 23:12           ` Borislav Petkov
@ 2020-12-13  3:35             ` Alan Modra
  2020-12-13 11:56               ` Borislav Petkov
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Modra @ 2020-12-13  3:35 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: binutils

On Sat, Dec 12, 2020 at 12:12:24AM +0100, Borislav Petkov wrote:
> Hi,
> 
> ok, below is what I got and it passes the checks.

It looks good to me.  Committed.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: x86: Do not dump DS/CS segment overrides for branch hints
  2020-12-13  3:35             ` Alan Modra
@ 2020-12-13 11:56               ` Borislav Petkov
  0 siblings, 0 replies; 10+ messages in thread
From: Borislav Petkov @ 2020-12-13 11:56 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Sun, Dec 13, 2020 at 02:05:27PM +1030, Alan Modra wrote:
> It looks good to me.  Committed.

Cool, thanks for writing the changelog.

:-)

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-13 11:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02  7:19 x86: Do not dump DS/CS segment overrides for branch hints Alan Modra
2020-12-02  9:44 ` Borislav Petkov
2020-12-02 10:45 ` Borislav Petkov
2020-12-02 11:10   ` Borislav Petkov
2020-12-07 14:15     ` Maciej W. Rozycki
2020-12-07 22:16       ` Alan Modra
2020-12-07 22:38         ` Borislav Petkov
2020-12-11 23:12           ` Borislav Petkov
2020-12-13  3:35             ` Alan Modra
2020-12-13 11:56               ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).