public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld: Fix pr22269-1 on 32-bit Solaris/SPARC
@ 2020-04-08 14:31 Rainer Orth
  2020-04-09  8:20 ` Jose E. Marchesi
  2020-04-09  9:51 ` Nick Clifton
  0 siblings, 2 replies; 3+ messages in thread
From: Rainer Orth @ 2020-04-08 14:31 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 2417 bytes --]

pr22269-1.s currently FAILs to assemble on 32-bit Solaris/SPARC:

ERROR:  -K PIC tmpdir/pr22269-1.s: assembly failed
UNRESOLVED: pr22269-1 (static pie undefined weak)

tmpdir/pr22269-1.s: Assembler messages:
tmpdir/pr22269-1.s:27: Error: Architecture mismatch on "be,pn %icc,.LL4 ,pn %icc,.LL4".
tmpdir/pr22269-1.s:27: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
tmpdir/pr22269-1.s:32: Error: Architecture mismatch on "return %i7+8".
tmpdir/pr22269-1.s:32: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
tmpdir/pr22269-1.s:36: Error: Architecture mismatch on "return %i7+8".
tmpdir/pr22269-1.s:36: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)

I could trace this to the fact that gcc on sparc-sun-solaris2.* defaults
to --with-cpu=v9.  So the gcc -S step of compiling the testcase is run
with -mcpu=v9, while the manual invocation of as-new lacks the
corresponding -Av9, creating a mismatch.

Solaris seems to be the only affected target, otherwise only
64-bit-default configurations default to --with-cpu=v9 or
--with-cpu=ultrasparc: sparcv9-*-*, sparc64-*-*,
sparc64-*-freebsd*, ultrasparc-*-freebsd*, and sparc64-*-openbsd*.

I see two possible solutions:

* Don't invoke as-new directly, but let gcc do it so the compiler and
  assembler options match, just as is done for ld-new invocations via
  the symlinks in ld/tmpdir/ld where an as symlink is already created.
  However, one would have to prefix all assembler options with -Wa, to
  get them through the compiler driver and one has less control over the
  as-new invocations due to what gcc passes on its own.

* Alternatively, one could just add -Av9 to AFLAGS_PIC in
  ld-elf/shared.exp and be done with it.  While less general than the
  first option, it has a precedent in ld-elfvers/vers.exp where -Av9a is
  added to as_options on sparc-*-*.  I can't tell if there's a downside
  to that solution.

The patch below implements the second alternative.  It lets the test
pass and causes no other changes in sparc-sun-solaris2.11 test results.

Ok for master?

	Rainer

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


2020-04-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* testsuite/ld-elf/shared.exp: Add -Av9 to AFLAGS_PIC on sparc*-*-*.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ld-sparcv7-pr22269-1.patch --]
[-- Type: text/x-patch, Size: 398 bytes --]

diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -46,7 +46,7 @@ if [istarget "tic6x-*-*"] {
     append AFLAGS_PIC " -mpic -mpid=near"
 }
 if [istarget "sparc*-*-*"] {
-    append AFLAGS_PIC " -K PIC"
+    append AFLAGS_PIC " -K PIC -Av9"
 }
 
 # GAS options to disable program property note.

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

* Re: ld: Fix pr22269-1 on 32-bit Solaris/SPARC
  2020-04-08 14:31 ld: Fix pr22269-1 on 32-bit Solaris/SPARC Rainer Orth
@ 2020-04-09  8:20 ` Jose E. Marchesi
  2020-04-09  9:51 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Jose E. Marchesi @ 2020-04-09  8:20 UTC (permalink / raw)
  To: Rainer Orth; +Cc: binutils


    pr22269-1.s currently FAILs to assemble on 32-bit Solaris/SPARC:
    
    ERROR:  -K PIC tmpdir/pr22269-1.s: assembly failed
    UNRESOLVED: pr22269-1 (static pie undefined weak)
    
    tmpdir/pr22269-1.s: Assembler messages:
    tmpdir/pr22269-1.s:27: Error: Architecture mismatch on "be,pn %icc,.LL4 ,pn %icc,.LL4".
    tmpdir/pr22269-1.s:27: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
    tmpdir/pr22269-1.s:32: Error: Architecture mismatch on "return %i7+8".
    tmpdir/pr22269-1.s:32: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
    tmpdir/pr22269-1.s:36: Error: Architecture mismatch on "return %i7+8".
    tmpdir/pr22269-1.s:36: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
    
    I could trace this to the fact that gcc on sparc-sun-solaris2.* defaults
    to --with-cpu=v9.  So the gcc -S step of compiling the testcase is run
    with -mcpu=v9, while the manual invocation of as-new lacks the
    corresponding -Av9, creating a mismatch.
    
    Solaris seems to be the only affected target, otherwise only
    64-bit-default configurations default to --with-cpu=v9 or
    --with-cpu=ultrasparc: sparcv9-*-*, sparc64-*-*,
    sparc64-*-freebsd*, ultrasparc-*-freebsd*, and sparc64-*-openbsd*.
    
    I see two possible solutions:
    
    * Don't invoke as-new directly, but let gcc do it so the compiler and
      assembler options match, just as is done for ld-new invocations via
      the symlinks in ld/tmpdir/ld where an as symlink is already created.
      However, one would have to prefix all assembler options with -Wa, to
      get them through the compiler driver and one has less control over the
      as-new invocations due to what gcc passes on its own.
    
    * Alternatively, one could just add -Av9 to AFLAGS_PIC in
      ld-elf/shared.exp and be done with it.  While less general than the
      first option, it has a precedent in ld-elfvers/vers.exp where -Av9a is
      added to as_options on sparc-*-*.  I can't tell if there's a downside
      to that solution.
    
    The patch below implements the second alternative.  It lets the test
    pass and causes no other changes in sparc-sun-solaris2.11 test results.
    
    Ok for master?
    
Looks like a good solution to me.

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

* Re: ld: Fix pr22269-1 on 32-bit Solaris/SPARC
  2020-04-08 14:31 ld: Fix pr22269-1 on 32-bit Solaris/SPARC Rainer Orth
  2020-04-09  8:20 ` Jose E. Marchesi
@ 2020-04-09  9:51 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2020-04-09  9:51 UTC (permalink / raw)
  To: Rainer Orth, binutils

Hi Rainer,

> The patch below implements the second alternative.  It lets the test
> pass and causes no other changes in sparc-sun-solaris2.11 test results.
> 
> Ok for master?

Approved - please apply.

Cheers
  Nick



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

end of thread, other threads:[~2020-04-09  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 14:31 ld: Fix pr22269-1 on 32-bit Solaris/SPARC Rainer Orth
2020-04-09  8:20 ` Jose E. Marchesi
2020-04-09  9:51 ` Nick Clifton

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).