Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86

Message ID yddo95wz2fi.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series
  • Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
Related show

Commit Message

Rainer Orth March 27, 2019, 4:50 p.m.
The fix H.J. implemented for PR gas/22791 in the thread starting at

	[PATCH] x86-64: Treat PC32 relocation with branch as PLT32
	https://sourceware.org/ml/binutils/2018-02/msg00065.html

is causing problems on Solaris/x86.  The native linker is strongly
preferred there, and there's no intention of implementing the linker
optimization he plans there.  Besides, the kernel runtime linker,
otherwise has no need to deal with that reloc at all, and instead of
adding (possibly even more) workarounds with no benefit, it seems
appropriate to disable the R_X86_64_PLT32 generation as branch marker on
Solaris/x86 in the first place.

The patch itself is trivial, the only complication is adapting the
testsuite.  Since I've found no way to have conditional sections in the
.d files, I've instead used the solution already found elsewhere of
having separate .d files for the affected tests on Solaris and selecting
the right one in i386/i386.exp.

Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without
regressions.  Ok for master (and perhaps the 2.32 branch)?

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-03-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
	* testsuite/gas/i386/reloc64-solaris.d,
	testsuite/gas/i386/x86-64-jump-solaris.d,
	testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d,
	testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d,
	testsuite/gas/i386/x86-64-nop-3-solaris.d,
	testsuite/gas/i386/x86-64-nop-4-solaris.d,
	testsuite/gas/i386/x86-64-nop-5-solaris.d,
	testsuite/gas/i386/x86-64-relax-2-solaris.d,
	testsuite/gas/i386/x86-64-relax-3-solaris.d: New tests.
	* testsuite/gas/i386/i386.exp: Use non-R_X86_64_PLT32 variants on
	Solaris.

Comments

Rainer Orth April 3, 2019, 8:50 a.m. | #1
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The fix H.J. implemented for PR gas/22791 in the thread starting at

>

> 	[PATCH] x86-64: Treat PC32 relocation with branch as PLT32

> 	https://sourceware.org/ml/binutils/2018-02/msg00065.html

>

> is causing problems on Solaris/x86.  The native linker is strongly

> preferred there, and there's no intention of implementing the linker

> optimization he plans there.  Besides, the kernel runtime linker,

> otherwise has no need to deal with that reloc at all, and instead of

> adding (possibly even more) workarounds with no benefit, it seems

> appropriate to disable the R_X86_64_PLT32 generation as branch marker on

> Solaris/x86 in the first place.

>

> The patch itself is trivial, the only complication is adapting the

> testsuite.  Since I've found no way to have conditional sections in the

> .d files, I've instead used the solution already found elsewhere of

> having separate .d files for the affected tests on Solaris and selecting

> the right one in i386/i386.exp.

>

> Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without

> regressions.  Ok for master (and perhaps the 2.32 branch)?


H.J., any word on this patch?  It's been a week...

	https://sourceware.org/ml/binutils/2019-03/msg00163.html

Thanks
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
H.J. Lu April 3, 2019, 12:42 p.m. | #2
On Wed, Mar 27, 2019 at 9:51 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> The fix H.J. implemented for PR gas/22791 in the thread starting at

>

>         [PATCH] x86-64: Treat PC32 relocation with branch as PLT32

>         https://sourceware.org/ml/binutils/2018-02/msg00065.html

>

> is causing problems on Solaris/x86.  The native linker is strongly

> preferred there, and there's no intention of implementing the linker

> optimization he plans there.  Besides, the kernel runtime linker,

> otherwise has no need to deal with that reloc at all, and instead of

> adding (possibly even more) workarounds with no benefit, it seems

> appropriate to disable the R_X86_64_PLT32 generation as branch marker on

> Solaris/x86 in the first place.

>

> The patch itself is trivial, the only complication is adapting the

> testsuite.  Since I've found no way to have conditional sections in the

> .d files, I've instead used the solution already found elsewhere of

> having separate .d files for the affected tests on Solaris and selecting

> the right one in i386/i386.exp.

>

> Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without

> regressions.  Ok for master (and perhaps the 2.32 branch)?

>

> Thanks.

>         Rainer

>

> --

> -----------------------------------------------------------------------------

> Rainer Orth, Center for Biotechnology, Bielefeld University

>

>

> 2019-03-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

>

>         * config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.

>         * testsuite/gas/i386/reloc64-solaris.d,

>         testsuite/gas/i386/x86-64-jump-solaris.d,

>         testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d,

>         testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d,

>         testsuite/gas/i386/x86-64-nop-3-solaris.d,

>         testsuite/gas/i386/x86-64-nop-4-solaris.d,

>         testsuite/gas/i386/x86-64-nop-5-solaris.d,

>         testsuite/gas/i386/x86-64-relax-2-solaris.d,

>         testsuite/gas/i386/x86-64-relax-3-solaris.d: New tests.

>         * testsuite/gas/i386/i386.exp: Use non-R_X86_64_PLT32 variants on

>         Solaris.

>


This may not be the first case where Solaris wants to be different.
Please create a subdirectory, solaris, with copies of those tests and
skip original tests for Solaris targets so that the original tests can be
updated without affecting Solaris targets.

Thanks.

-- 
H.J.
Rainer Orth April 3, 2019, 2:24 p.m. | #3
Hi H.J.,

> This may not be the first case where Solaris wants to be different.


only if following suite gives no benefit ;-)

> Please create a subdirectory, solaris, with copies of those tests and

> skip original tests for Solaris targets so that the original tests can be

> updated without affecting Solaris targets.


How would this help?  Do you want me to create copies of the affected .s
files and move the *-solaris.d files both to that solaris subdirectory?
If gas produces different output for identical input, the solaris .d
files have to be changed anyway, irrespective of their location.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
H.J. Lu April 3, 2019, 2:41 p.m. | #4
On Wed, Apr 3, 2019 at 7:24 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> Hi H.J.,

>

> > This may not be the first case where Solaris wants to be different.

>

> only if following suite gives no benefit ;-)

>

> > Please create a subdirectory, solaris, with copies of those tests and

> > skip original tests for Solaris targets so that the original tests can be

> > updated without affecting Solaris targets.

>

> How would this help?  Do you want me to create copies of the affected .s

> files and move the *-solaris.d files both to that solaris subdirectory?


Yes.

> If gas produces different output for identical input, the solaris .d

> files have to be changed anyway, irrespective of their location.

>


Not necessarily.  Initially both inputs are the same.  But it may
change over time.

-- 
H.J.
Rainer Orth April 3, 2019, 2:50 p.m. | #5
Hi H.J.,

>> > Please create a subdirectory, solaris, with copies of those tests and

>> > skip original tests for Solaris targets so that the original tests can be

>> > updated without affecting Solaris targets.

>>

>> How would this help?  Do you want me to create copies of the affected .s

>> files and move the *-solaris.d files both to that solaris subdirectory?

>

> Yes.

>

>> If gas produces different output for identical input, the solaris .d

>> files have to be changed anyway, irrespective of their location.

>

> Not necessarily.  Initially both inputs are the same.  But it may

> change over time.


True, but in the overwhelming majority of cases, gas will produce the
same output on both Linux and Solaris.  When we stay with only one set
of .s files, one immediately notices the need to adapt the Solaris .d
files the next time make check is run, without any impact on other
targets.  We can still fork the inputs should it really becomes
necessary at some point.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
H.J. Lu April 3, 2019, 3:13 p.m. | #6
On Wed, Apr 3, 2019 at 7:50 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> Hi H.J.,

>

> >> > Please create a subdirectory, solaris, with copies of those tests and

> >> > skip original tests for Solaris targets so that the original tests can be

> >> > updated without affecting Solaris targets.

> >>

> >> How would this help?  Do you want me to create copies of the affected .s

> >> files and move the *-solaris.d files both to that solaris subdirectory?

> >

> > Yes.

> >

> >> If gas produces different output for identical input, the solaris .d

> >> files have to be changed anyway, irrespective of their location.

> >

> > Not necessarily.  Initially both inputs are the same.  But it may

> > change over time.

>

> True, but in the overwhelming majority of cases, gas will produce the

> same output on both Linux and Solaris.  When we stay with only one set

> of .s files, one immediately notices the need to adapt the Solaris .d

> files the next time make check is run, without any impact on other

> targets.  We can still fork the inputs should it really becomes

> necessary at some point.


You can initially use "#source:" in solaris directory and make a
copy later when needed.  I want the original tests not tied to Solaris.

-- 
H.J.
Rainer Orth April 9, 2019, 8:21 a.m. | #7
Hi H.J.,

> On Wed, Apr 3, 2019 at 7:50 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:

>>

>> Hi H.J.,

>>

>> >> > Please create a subdirectory, solaris, with copies of those tests and

>> >> > skip original tests for Solaris targets so that the original tests can be

>> >> > updated without affecting Solaris targets.

>> >>

>> >> How would this help?  Do you want me to create copies of the affected .s

>> >> files and move the *-solaris.d files both to that solaris subdirectory?

>> >

>> > Yes.

>> >

>> >> If gas produces different output for identical input, the solaris .d

>> >> files have to be changed anyway, irrespective of their location.

>> >

>> > Not necessarily.  Initially both inputs are the same.  But it may

>> > change over time.

>>

>> True, but in the overwhelming majority of cases, gas will produce the

>> same output on both Linux and Solaris.  When we stay with only one set

>> of .s files, one immediately notices the need to adapt the Solaris .d

>> files the next time make check is run, without any impact on other

>> targets.  We can still fork the inputs should it really becomes

>> necessary at some point.

>

> You can initially use "#source:" in solaris directory and make a

> copy later when needed.  I want the original tests not tied to Solaris.


here's what I came up with.  I'm not too pleased with the result, though:
unlike the previous version with the optional -solaris suffix for the .d
files, you loose the obvious connection between the tests in the i386
directory and the i386/solaris one.  I tried to use an optional solaris/
prefix in the test names instead, but this failed since run_dump_test
considers every test name with a slash in it to be an absolute
filename.

Anyway, tested without regressions on amd64-pc-solaris2.11 and
x86_64-pc-linux-gnu.  Ok for master?

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-03-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
	* testsuite/gas/i386/solaris/solaris.exp: New driver.
	* testsuite/gas/i386/solaris/reloc64.d,
	testsuite/gas/i386/solaris/x86-64-jump.d,
	testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,
	testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d,
	testsuite/gas/i386/solaris/x86-64-nop-3.d,
	testsuite/gas/i386/solaris/x86-64-nop-4.d,
	testsuite/gas/i386/solaris/x86-64-nop-5.d,
	testsuite/gas/i386/solaris/x86-64-relax-2.d,
	testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests.
	* testsuite/gas/i386/reloc64.d,
	testsuite/gas/i386/x86-64-jump.d,
	testsuite/gas/i386/x86-64-mpx-branch-1.d,
	testsuite/gas/i386/x86-64-mpx-branch-2.d,
	testsuite/gas/i386/x86-64-nop-3.d,
	testsuite/gas/i386/x86-64-nop-4.d,
	testsuite/gas/i386/x86-64-nop-5.d,
	testsuite/gas/i386/x86-64-relax-2.d,
	testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.
# HG changeset patch
# Parent  85a01abb001febb74d8425f1cd2198c16fd1ae4d
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7784,6 +7784,12 @@ need_plt32_p (symbolS *s)
   if (!IS_ELF)
     return FALSE;
 
+#ifdef TE_SOLARIS
+  /* Don't emit PLT32 relocation on Solaris: neither native linker nor
+     krtld support it.  */
+  return FALSE;
+#endif
+
   /* Since there is no need to prepare for PLT branch on x86-64, we
      can generate R_X86_64_PLT32, instead of R_X86_64_PC32, which can
      be used as a marker for 32-bit PC-relative branches.  */
diff --git a/gas/testsuite/gas/i386/reloc64.d b/gas/testsuite/gas/i386/reloc64.d
--- a/gas/testsuite/gas/i386/reloc64.d
+++ b/gas/testsuite/gas/i386/reloc64.d
@@ -1,6 +1,7 @@
 #as: -mx86-used-note=no
 #objdump: -Drw
 #name: x86-64 relocs
+#notarget: *-*-solaris*
 
 .*: +file format .*x86-64.*
 
diff --git a/gas/testsuite/gas/i386/solaris/reloc64.d b/gas/testsuite/gas/i386/solaris/reloc64.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/reloc64.d
@@ -0,0 +1,99 @@
+#as: -mx86-used-note=no
+#source: ../reloc64.s
+#objdump: -Drw
+#name: x86-64 relocs
+
+.*: +file format .*x86-64.*
+
+Disassembly of section \.text:
+#...
+.*[ 	]+R_X86_64_64[ 	]+xtrn
+.*[ 	]+R_X86_64_32S[ 	]+xtrn
+.*[ 	]+R_X86_64_32[ 	]+xtrn
+.*[ 	]+R_X86_64_16[ 	]+xtrn
+.*[ 	]+R_X86_64_8[ 	]+xtrn
+.*[ 	]+R_X86_64_32S[ 	]+xtrn
+.*[ 	]+R_X86_64_32[ 	]+xtrn
+.*[ 	]+R_X86_64_PC64[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC16[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn\+0x0*1
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn-0x0*1
+.*[ 	]+R_X86_64_GOT64[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTOFF64[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_GOTPC32[ 	]+_GLOBAL_OFFSET_TABLE_\+0x0*2
+.*[ 	]+R_X86_64_GOTPC32[ 	]+_GLOBAL_OFFSET_TAB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+.*[ 	]+R_X86_64_8[ 	]+xtrn
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn-0x4
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn\+0x4
+.*[ 	]+R_X86_64_GOTPLT64[ 	]+xtrn
diff --git a/gas/testsuite/gas/i386/solaris/solaris.exp b/gas/testsuite/gas/i386/solaris/solaris.exp
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/solaris.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  
+
+#
+# Solaris i386 tests
+#
+proc gas_64_check { } {
+    global NM
+    global NMFLAGS
+
+    set status [gas_host_run "$NM $NMFLAGS --help" ""]
+    return [regexp "targets:.*x86-64" [lindex $status 1]];
+}
+
+if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check] && [istarget "*-*-solaris*"]] then {
+
+    global ASFLAGS
+    set old_ASFLAGS "$ASFLAGS"
+    set ASFLAGS "$ASFLAGS --64 --defsym x86_64=1 --strip-local-absolute"
+
+    run_dump_test "reloc64"
+    run_dump_test "x86-64-mpx-branch-1"
+    run_dump_test "x86-64-mpx-branch-2"
+
+    run_dump_test "x86-64-relax-2"
+    run_dump_test "x86-64-relax-3"
+
+    run_dump_test "x86-64-jump"
+
+    run_dump_test "x86-64-nop-3"
+    run_dump_test "x86-64-nop-4"
+    run_dump_test "x86-64-nop-5"
+
+    set ASFLAGS "$old_ASFLAGS"
+}
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-jump.d b/gas/testsuite/gas/i386/solaris/x86-64-jump.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-jump.d
@@ -0,0 +1,44 @@
+#objdump: -drw
+#source: ../x86-64-jump.s
+#name: x86-64 jump
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <.text>:
+[ 	]*[a-f0-9]+:	eb fe                	jmp    (0x0|0 <.text>)
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   0x7	3: R_X86_64_PC32	xxx-0x4
+[ 	]*[a-f0-9]+:	ff 24 25 00 00 00 00 	jmpq   \*0x0	a: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff e7                	jmpq   \*%rdi
+[ 	]*[a-f0-9]+:	ff 27                	jmpq   \*\(%rdi\)
+[ 	]*[a-f0-9]+:	ff 2c bd 00 00 00 00 	ljmp   \*0x0\(,%rdi,4\)	15: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 2c bd 00 00 00 00 	ljmpw  \*0x0\(,%rdi,4\)	1d: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff 2c 25 00 00 00 00 	ljmp   \*0x0	24: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 2c 25 00 00 00 00 	ljmpw  \*0x0	2c: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	e8 cb ff ff ff       	callq  0x0
+[ 	]*[a-f0-9]+:	e8 00 00 00 00       	callq  0x3a	36: R_X86_64_PC32	xxx-0x4
+[ 	]*[a-f0-9]+:	ff 14 25 00 00 00 00 	callq  \*0x0	3d: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff d7                	callq  \*%rdi
+[ 	]*[a-f0-9]+:	ff 17                	callq  \*\(%rdi\)
+[ 	]*[a-f0-9]+:	ff 1c bd 00 00 00 00 	lcall  \*0x0\(,%rdi,4\)	48: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 1c bd 00 00 00 00 	lcallw \*0x0\(,%rdi,4\)	50: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff 1c 25 00 00 00 00 	lcall  \*0x0	57: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 1c 25 00 00 00 00 	lcallw \*0x0	5f: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	67 e3 00             	jecxz  0x66	65: R_X86_64_PC8	\$\+0x2
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	e3 00                	jrcxz  0x69	68: R_X86_64_PC8	\$\+0x1
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	66 ff 13             	callw  \*\(%rbx\)
+[ 	]*[a-f0-9]+:	ff 1b                	lcall  \*\(%rbx\)
+[ 	]*[a-f0-9]+:	66 ff 23             	jmpw   \*\(%rbx\)
+[ 	]*[a-f0-9]+:	ff 2b                	ljmp   \*\(%rbx\)
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x76
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	67 e3 00             	jecxz  0x7a
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	e3 00                	jrcxz  0x7d
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x80
+#pass
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d b/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d
@@ -0,0 +1,29 @@
+#as: -J
+#source: ../x86-64-mpx-branch-1.s
+#objdump: -dwr
+#name: x86-64 MPX branch
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 6 <foo1-0x6>	2: R_X86_64_PC32	\*ABS\*\+0x10003c
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq c <foo1>	8: R_X86_64_PC32	\*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ 	]*[a-f0-9]+:	f2 eb fd             	bnd jmp c <foo1>
+[ 	]*[a-f0-9]+:	f2 72 fa             	bnd jb c <foo1>
+[ 	]*[a-f0-9]+:	f2 e8 f4 ff ff ff    	bnd callq c <foo1>
+[ 	]*[a-f0-9]+:	f2 eb 09             	bnd jmp 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 72 06             	bnd jb 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 2a <foo2\+0x6>	26: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 31 <foo2\+0xd>	2d: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 37 <foo2\+0x13>	33: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 3d <foo2\+0x19>	39: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 44 <foo2\+0x20>	40: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 4a <foo2\+0x26>	46: R_X86_64_PLT32	foo-0x4
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d b/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d
@@ -0,0 +1,29 @@
+#as: -J -madd-bnd-prefix
+#source: ../x86-64-mpx-branch-2.s
+#objdump: -dwr
+#name: x86-64 branch with BND prefix
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 6 <foo1-0x6>	2: R_X86_64_PC32	\*ABS\*\+0x10003c
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq c <foo1>	8: R_X86_64_PC32	\*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ 	]*[a-f0-9]+:	f2 eb fd             	bnd jmp c <foo1>
+[ 	]*[a-f0-9]+:	f2 72 fa             	bnd jb c <foo1>
+[ 	]*[a-f0-9]+:	f2 e8 f4 ff ff ff    	bnd callq c <foo1>
+[ 	]*[a-f0-9]+:	f2 eb 09             	bnd jmp 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 72 06             	bnd jb 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 2a <foo2\+0x6>	26: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 31 <foo2\+0xd>	2d: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 37 <foo2\+0x13>	33: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 3d <foo2\+0x19>	39: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 44 <foo2\+0x20>	40: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 4a <foo2\+0x26>	46: R_X86_64_PLT32	foo-0x4
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-nop-3.d b/gas/testsuite/gas/i386/solaris/x86-64-nop-3.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-nop-3.d
@@ -0,0 +1,21 @@
+#source: ../nop-3.s
+#objdump: -drw
+#name: x86-64 .nops 3
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	0f 1f 00             	nopl   \(%rax\)
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   5 <_start\+0x5>	1: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-nop-4.d b/gas/testsuite/gas/i386/solaris/x86-64-nop-4.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-nop-4.d
@@ -0,0 +1,24 @@
+#source: ../nop-4.s
+#objdump: -drw
+#name: x86-64 .nops 4
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	66 0f 1f 84 00 00 00 00 00 	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   b <_start\+0xb>	7: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-nop-5.d b/gas/testsuite/gas/i386/solaris/x86-64-nop-5.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-nop-5.d
@@ -0,0 +1,27 @@
+#source: ../nop-5.s
+#objdump: -drw
+#name: x86-64 .nops 5
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	0f 1f 44 00 00       	nopl   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	0f 1f 44 00 00       	nopl   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	90                   	nop
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   d <_start\+0xd>	9: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-relax-2.d b/gas/testsuite/gas/i386/solaris/x86-64-relax-2.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-relax-2.d
@@ -0,0 +1,34 @@
+#source: ../relax-3.s
+#as: -mshared
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ 	]*[a-f0-9]+:	eb 24                	jmp    26 <local>
+[ 	]*[a-f0-9]+:	eb 1e                	jmp    22 <hidden_def>
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   9 <foo\+0x9>	5: R_X86_64_PC32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   e <foo\+0xe>	a: R_X86_64_PLT32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   13 <foo\+0x13>	f: R_X86_64_PC32	weak_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   18 <foo\+0x18>	14: R_X86_64_PC32	weak_hidden_undef-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1d <foo\+0x1d>	19: R_X86_64_PC32	weak_hidden_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   22 <hidden_def>	1e: R_X86_64_PC32	hidden_undef-0x4
+
+0+22 <hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+23 <weak_hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+24 <global_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+25 <weak_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+26 <local>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+#pass
diff --git a/gas/testsuite/gas/i386/solaris/x86-64-relax-3.d b/gas/testsuite/gas/i386/solaris/x86-64-relax-3.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/solaris/x86-64-relax-3.d
@@ -0,0 +1,33 @@
+#source: ../relax-3.s
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ 	]*[a-f0-9]+:	eb 21                	jmp    23 <local>
+[ 	]*[a-f0-9]+:	eb 1b                	jmp    1f <hidden_def>
+[ 	]*[a-f0-9]+:	eb 1b                	jmp    21 <global_def>
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   b <foo\+0xb>	7: R_X86_64_PLT32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   10 <foo\+0x10>	c: R_X86_64_PC32	weak_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   15 <foo\+0x15>	11: R_X86_64_PC32	weak_hidden_undef-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1a <foo\+0x1a>	16: R_X86_64_PC32	weak_hidden_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1f <hidden_def>	1b: R_X86_64_PC32	hidden_undef-0x4
+
+0+1f <hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+20 <weak_hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+21 <global_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+22 <weak_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+23 <local>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-jump.d b/gas/testsuite/gas/i386/x86-64-jump.d
--- a/gas/testsuite/gas/i386/x86-64-jump.d
+++ b/gas/testsuite/gas/i386/x86-64-jump.d
@@ -1,5 +1,6 @@
 #objdump: -drw
 #name: x86-64 jump
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
--- a/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
@@ -1,6 +1,7 @@
 #as: -J
 #objdump: -dwr
 #name: x86-64 MPX branch
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
--- a/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
@@ -1,6 +1,7 @@
 #as: -J -madd-bnd-prefix
 #objdump: -dwr
 #name: x86-64 branch with BND prefix
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-nop-3.d b/gas/testsuite/gas/i386/x86-64-nop-3.d
--- a/gas/testsuite/gas/i386/x86-64-nop-3.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-3.d
@@ -1,6 +1,7 @@
 #source: nop-3.s
 #objdump: -drw
 #name: x86-64 .nops 3
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-nop-4.d b/gas/testsuite/gas/i386/x86-64-nop-4.d
--- a/gas/testsuite/gas/i386/x86-64-nop-4.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-4.d
@@ -1,6 +1,7 @@
 #source: nop-4.s
 #objdump: -drw
 #name: x86-64 .nops 4
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-nop-5.d b/gas/testsuite/gas/i386/x86-64-nop-5.d
--- a/gas/testsuite/gas/i386/x86-64-nop-5.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-5.d
@@ -1,6 +1,7 @@
 #source: nop-5.s
 #objdump: -drw
 #name: x86-64 .nops 5
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-relax-2.d b/gas/testsuite/gas/i386/x86-64-relax-2.d
--- a/gas/testsuite/gas/i386/x86-64-relax-2.d
+++ b/gas/testsuite/gas/i386/x86-64-relax-2.d
@@ -1,6 +1,7 @@
 #source: relax-3.s
 #as: -mshared
 #objdump: -dwr
+#notarget: *-*-solaris*
 
 .*: +file format .*
 
diff --git a/gas/testsuite/gas/i386/x86-64-relax-3.d b/gas/testsuite/gas/i386/x86-64-relax-3.d
--- a/gas/testsuite/gas/i386/x86-64-relax-3.d
+++ b/gas/testsuite/gas/i386/x86-64-relax-3.d
@@ -1,5 +1,6 @@
 #source: relax-3.s
 #objdump: -dwr
+#notarget: *-*-solaris*
 
 .*: +file format .*
H.J. Lu April 9, 2019, 7:46 p.m. | #8
On Tue, Apr 9, 2019 at 1:22 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> Hi H.J.,

>

> > On Wed, Apr 3, 2019 at 7:50 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:

> >>

> >> Hi H.J.,

> >>

> >> >> > Please create a subdirectory, solaris, with copies of those tests and

> >> >> > skip original tests for Solaris targets so that the original tests can be

> >> >> > updated without affecting Solaris targets.

> >> >>

> >> >> How would this help?  Do you want me to create copies of the affected .s

> >> >> files and move the *-solaris.d files both to that solaris subdirectory?

> >> >

> >> > Yes.

> >> >

> >> >> If gas produces different output for identical input, the solaris .d

> >> >> files have to be changed anyway, irrespective of their location.

> >> >

> >> > Not necessarily.  Initially both inputs are the same.  But it may

> >> > change over time.

> >>

> >> True, but in the overwhelming majority of cases, gas will produce the

> >> same output on both Linux and Solaris.  When we stay with only one set

> >> of .s files, one immediately notices the need to adapt the Solaris .d

> >> files the next time make check is run, without any impact on other

> >> targets.  We can still fork the inputs should it really becomes

> >> necessary at some point.

> >

> > You can initially use "#source:" in solaris directory and make a

> > copy later when needed.  I want the original tests not tied to Solaris.

>

> here's what I came up with.  I'm not too pleased with the result, though:

> unlike the previous version with the optional -solaris suffix for the .d

> files, you loose the obvious connection between the tests in the i386

> directory and the i386/solaris one.  I tried to use an optional solaris/

> prefix in the test names instead, but this failed since run_dump_test

> considers every test name with a slash in it to be an absolute

> filename.

>

> Anyway, tested without regressions on amd64-pc-solaris2.11 and

> x86_64-pc-linux-gnu.  Ok for master?

>

> Thanks.

>         Rainer

>

> --

> -----------------------------------------------------------------------------

> Rainer Orth, Center for Biotechnology, Bielefeld University

>

>

> 2019-03-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

>

>         * config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.

>         * testsuite/gas/i386/solaris/solaris.exp: New driver.

>         * testsuite/gas/i386/solaris/reloc64.d,

>         testsuite/gas/i386/solaris/x86-64-jump.d,

>         testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,

>         testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d,

>         testsuite/gas/i386/solaris/x86-64-nop-3.d,

>         testsuite/gas/i386/solaris/x86-64-nop-4.d,

>         testsuite/gas/i386/solaris/x86-64-nop-5.d,

>         testsuite/gas/i386/solaris/x86-64-relax-2.d,

>         testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests.

>         * testsuite/gas/i386/reloc64.d,

>         testsuite/gas/i386/x86-64-jump.d,

>         testsuite/gas/i386/x86-64-mpx-branch-1.d,

>         testsuite/gas/i386/x86-64-mpx-branch-2.d,

>         testsuite/gas/i386/x86-64-nop-3.d,

>         testsuite/gas/i386/x86-64-nop-4.d,

>         testsuite/gas/i386/x86-64-nop-5.d,

>         testsuite/gas/i386/x86-64-relax-2.d,

>         testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.

>


OK.  Thanks.

-- 
H.J.

Patch

# HG changeset patch
# Parent  2eb8cc27418899c8039e79f1e172df1076ea2889
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7784,6 +7784,12 @@  need_plt32_p (symbolS *s)
   if (!IS_ELF)
     return FALSE;
 
+#ifdef TE_SOLARIS
+  /* Don't emit PLT32 relocation on Solaris: neither native linker nor
+     krtld support it.  */
+  return FALSE;
+#endif
+
   /* Since there is no need to prepare for PLT branch on x86-64, we
      can generate R_X86_64_PLT32, instead of R_X86_64_PC32, which can
      be used as a marker for 32-bit PC-relative branches.  */
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1009,10 +1009,18 @@  if [expr ([istarget "i*86-*-*"] || [ista
 
     # ELF specific tests
     if [is_elf_format] then {
+	# Use separate .d files on Solaris/x86: gas doesn't emit PLT32
+	# relocations as branch markers there.
+	if { [istarget "*-*-solaris*"] } then {
+	    set plt32_suffix "-solaris"
+	} else {
+	    set plt32_suffix ""
+	}
+
 	# Verify that @unwind works.
 	run_dump_test "x86-64-unwind"
 
-	run_dump_test "reloc64"
+	run_dump_test "reloc64${plt32_suffix}"
 	run_list_test "reloc64" "--defsym _bad_=1"
 	run_dump_test "mixed-mode-reloc64"
 	run_dump_test "x86-64-ifunc"
@@ -1023,8 +1031,8 @@  if [expr ([istarget "i*86-*-*"] || [ista
 	run_dump_test "k1om"
 	run_dump_test "x86-64-localpic"
 	run_dump_test "debug1"
-	run_dump_test "x86-64-mpx-branch-1"
-	run_dump_test "x86-64-mpx-branch-2"
+	run_dump_test "x86-64-mpx-branch-1${plt32_suffix}"
+	run_dump_test "x86-64-mpx-branch-2${plt32_suffix}"
 
 	run_dump_test "x86-64-dw2-compress-2"
 	run_dump_test "x86-64-dw2-compressed-2"
@@ -1036,10 +1044,10 @@  if [expr ([istarget "i*86-*-*"] || [ista
 	run_dump_test "x86-64-size-5"
 	run_list_test "x86-64-size-inval-1" "-al"
 
-	run_dump_test "x86-64-relax-2"
-	run_dump_test "x86-64-relax-3"
+	run_dump_test "x86-64-relax-2${plt32_suffix}"
+	run_dump_test "x86-64-relax-3${plt32_suffix}"
 
-	run_dump_test "x86-64-jump"
+	run_dump_test "x86-64-jump${plt32_suffix}"
 	run_dump_test "x86-64-branch-2"
 	run_list_test "x86-64-branch-3" "-al -mintel64"
 	run_list_test "x86-64-branch-4" "-al -mintel64"
@@ -1049,9 +1057,9 @@  if [expr ([istarget "i*86-*-*"] || [ista
 	run_dump_test "x86-64-gotpcrel-2"
 
 	run_dump_test "x86-64-addend"
-	run_dump_test "x86-64-nop-3"
-	run_dump_test "x86-64-nop-4"
-	run_dump_test "x86-64-nop-5"
+	run_dump_test "x86-64-nop-3${plt32_suffix}"
+	run_dump_test "x86-64-nop-4${plt32_suffix}"
+	run_dump_test "x86-64-nop-5${plt32_suffix}"
 	run_dump_test "x86-64-nop-6"
 
 	run_dump_test "evex-no-scale-64"
diff --git a/gas/testsuite/gas/i386/reloc64-solaris.d b/gas/testsuite/gas/i386/reloc64-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/reloc64-solaris.d
@@ -0,0 +1,99 @@ 
+#as: -mx86-used-note=no
+#source: reloc64.s
+#objdump: -Drw
+#name: x86-64 relocs
+
+.*: +file format .*x86-64.*
+
+Disassembly of section \.text:
+#...
+.*[ 	]+R_X86_64_64[ 	]+xtrn
+.*[ 	]+R_X86_64_32S[ 	]+xtrn
+.*[ 	]+R_X86_64_32[ 	]+xtrn
+.*[ 	]+R_X86_64_16[ 	]+xtrn
+.*[ 	]+R_X86_64_8[ 	]+xtrn
+.*[ 	]+R_X86_64_32S[ 	]+xtrn
+.*[ 	]+R_X86_64_32[ 	]+xtrn
+.*[ 	]+R_X86_64_PC64[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC16[ 	]+xtrn\+0x0*2
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn\+0x0*1
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC32[ 	]+xtrn-0x0*4
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn-0x0*1
+.*[ 	]+R_X86_64_GOT64[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTOFF64[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn
+.*[ 	]+R_X86_64_GOTPCREL[ 	]+xtrn-0x0*4
+.*[ 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n
+.*[ 	]+R_X86_64_TPOFF32[ 	]+xtrn
+.*[ 	]+R_X86_64_16[ 	]+xtrn
+.*[ 	]+R_X86_64_PC16[ 	]+xtrn
+.*[ 	]+R_X86_64_8[ 	]+xtrn
+.*[ 	]+R_X86_64_PC8[ 	]+xtrn
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn-0x4
+.*[ 	]+R_X86_64_GOT32[ 	]+xtrn\+0x4
+.*[ 	]+R_X86_64_GOTPLT64[ 	]+xtrn
diff --git a/gas/testsuite/gas/i386/x86-64-jump-solaris.d b/gas/testsuite/gas/i386/x86-64-jump-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-jump-solaris.d
@@ -0,0 +1,44 @@ 
+#objdump: -drw
+#source: x86-64-jump.s
+#name: x86-64 jump
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <.text>:
+[ 	]*[a-f0-9]+:	eb fe                	jmp    (0x0|0 <.text>)
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   0x7	3: R_X86_64_PC32	xxx-0x4
+[ 	]*[a-f0-9]+:	ff 24 25 00 00 00 00 	jmpq   \*0x0	a: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff e7                	jmpq   \*%rdi
+[ 	]*[a-f0-9]+:	ff 27                	jmpq   \*\(%rdi\)
+[ 	]*[a-f0-9]+:	ff 2c bd 00 00 00 00 	ljmp   \*0x0\(,%rdi,4\)	15: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 2c bd 00 00 00 00 	ljmpw  \*0x0\(,%rdi,4\)	1d: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff 2c 25 00 00 00 00 	ljmp   \*0x0	24: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 2c 25 00 00 00 00 	ljmpw  \*0x0	2c: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	e8 cb ff ff ff       	callq  0x0
+[ 	]*[a-f0-9]+:	e8 00 00 00 00       	callq  0x3a	36: R_X86_64_PC32	xxx-0x4
+[ 	]*[a-f0-9]+:	ff 14 25 00 00 00 00 	callq  \*0x0	3d: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff d7                	callq  \*%rdi
+[ 	]*[a-f0-9]+:	ff 17                	callq  \*\(%rdi\)
+[ 	]*[a-f0-9]+:	ff 1c bd 00 00 00 00 	lcall  \*0x0\(,%rdi,4\)	48: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 1c bd 00 00 00 00 	lcallw \*0x0\(,%rdi,4\)	50: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	ff 1c 25 00 00 00 00 	lcall  \*0x0	57: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	66 ff 1c 25 00 00 00 00 	lcallw \*0x0	5f: R_X86_64_32S	xxx
+[ 	]*[a-f0-9]+:	67 e3 00             	jecxz  0x66	65: R_X86_64_PC8	\$\+0x2
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	e3 00                	jrcxz  0x69	68: R_X86_64_PC8	\$\+0x1
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	66 ff 13             	callw  \*\(%rbx\)
+[ 	]*[a-f0-9]+:	ff 1b                	lcall  \*\(%rbx\)
+[ 	]*[a-f0-9]+:	66 ff 23             	jmpw   \*\(%rbx\)
+[ 	]*[a-f0-9]+:	ff 2b                	ljmp   \*\(%rbx\)
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x76
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	67 e3 00             	jecxz  0x7a
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	e3 00                	jrcxz  0x7d
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	eb 00                	jmp    0x80
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d
@@ -0,0 +1,29 @@ 
+#as: -J
+#source: x86-64-mpx-branch-1.s
+#objdump: -dwr
+#name: x86-64 MPX branch
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 6 <foo1-0x6>	2: R_X86_64_PC32	\*ABS\*\+0x10003c
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq c <foo1>	8: R_X86_64_PC32	\*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ 	]*[a-f0-9]+:	f2 eb fd             	bnd jmp c <foo1>
+[ 	]*[a-f0-9]+:	f2 72 fa             	bnd jb c <foo1>
+[ 	]*[a-f0-9]+:	f2 e8 f4 ff ff ff    	bnd callq c <foo1>
+[ 	]*[a-f0-9]+:	f2 eb 09             	bnd jmp 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 72 06             	bnd jb 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 2a <foo2\+0x6>	26: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 31 <foo2\+0xd>	2d: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 37 <foo2\+0x13>	33: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 3d <foo2\+0x19>	39: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 44 <foo2\+0x20>	40: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 4a <foo2\+0x26>	46: R_X86_64_PLT32	foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d
@@ -0,0 +1,29 @@ 
+#as: -J -madd-bnd-prefix
+#source: x86-64-mpx-branch-2.s
+#objdump: -dwr
+#name: x86-64 branch with BND prefix
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 6 <foo1-0x6>	2: R_X86_64_PC32	\*ABS\*\+0x10003c
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq c <foo1>	8: R_X86_64_PC32	\*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ 	]*[a-f0-9]+:	f2 eb fd             	bnd jmp c <foo1>
+[ 	]*[a-f0-9]+:	f2 72 fa             	bnd jb c <foo1>
+[ 	]*[a-f0-9]+:	f2 e8 f4 ff ff ff    	bnd callq c <foo1>
+[ 	]*[a-f0-9]+:	f2 eb 09             	bnd jmp 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 72 06             	bnd jb 24 <foo2>
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 2a <foo2\+0x6>	26: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 31 <foo2\+0xd>	2d: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 37 <foo2\+0x13>	33: R_X86_64_PC32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e9 00 00 00 00    	bnd jmpq 3d <foo2\+0x19>	39: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 0f 82 00 00 00 00 	bnd jb 44 <foo2\+0x20>	40: R_X86_64_PLT32	foo-0x4
+[ 	]*[a-f0-9]+:	f2 e8 00 00 00 00    	bnd callq 4a <foo2\+0x26>	46: R_X86_64_PLT32	foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d
@@ -0,0 +1,21 @@ 
+#source: nop-3.s
+#objdump: -drw
+#name: x86-64 .nops 3
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	0f 1f 00             	nopl   \(%rax\)
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   5 <_start\+0x5>	1: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d
@@ -0,0 +1,24 @@ 
+#source: nop-4.s
+#objdump: -drw
+#name: x86-64 .nops 4
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	66 0f 1f 84 00 00 00 00 00 	nopw   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   b <_start\+0xb>	7: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d
@@ -0,0 +1,27 @@ 
+#source: nop-5.s
+#objdump: -drw
+#name: x86-64 .nops 5
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	85 c0                	test   %eax,%eax
+ +[a-f0-9]+:	0f 1f 44 00 00       	nopl   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	0f 1f 44 00 00       	nopl   0x0\(%rax,%rax,1\)
+ +[a-f0-9]+:	90                   	nop
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+ +[a-f0-9]+:	31 c0                	xor    %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	89 c0                	mov    %eax,%eax
+ +[a-f0-9]+:	e9 00 00 00 00       	jmpq   d <_start\+0xd>	9: R_X86_64_PC32	foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d b/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d
@@ -0,0 +1,34 @@ 
+#source: relax-3.s
+#as: -mshared
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ 	]*[a-f0-9]+:	eb 24                	jmp    26 <local>
+[ 	]*[a-f0-9]+:	eb 1e                	jmp    22 <hidden_def>
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   9 <foo\+0x9>	5: R_X86_64_PC32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   e <foo\+0xe>	a: R_X86_64_PLT32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   13 <foo\+0x13>	f: R_X86_64_PC32	weak_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   18 <foo\+0x18>	14: R_X86_64_PC32	weak_hidden_undef-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1d <foo\+0x1d>	19: R_X86_64_PC32	weak_hidden_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   22 <hidden_def>	1e: R_X86_64_PC32	hidden_undef-0x4
+
+0+22 <hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+23 <weak_hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+24 <global_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+25 <weak_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+26 <local>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d b/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d
@@ -0,0 +1,33 @@ 
+#source: relax-3.s
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ 	]*[a-f0-9]+:	eb 21                	jmp    23 <local>
+[ 	]*[a-f0-9]+:	eb 1b                	jmp    1f <hidden_def>
+[ 	]*[a-f0-9]+:	eb 1b                	jmp    21 <global_def>
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   b <foo\+0xb>	7: R_X86_64_PLT32	global_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   10 <foo\+0x10>	c: R_X86_64_PC32	weak_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   15 <foo\+0x15>	11: R_X86_64_PC32	weak_hidden_undef-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1a <foo\+0x1a>	16: R_X86_64_PC32	weak_hidden_def-0x4
+[ 	]*[a-f0-9]+:	e9 00 00 00 00       	jmpq   1f <hidden_def>	1b: R_X86_64_PC32	hidden_undef-0x4
+
+0+1f <hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+20 <weak_hidden_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+21 <global_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+22 <weak_def>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+
+0+23 <local>:
+[ 	]*[a-f0-9]+:	c3                   	retq   
+#pass