]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: testsuite: Only xfail "shared (non PIC)" etc. on 64-bit Solaris master
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 22 Aug 2025 09:04:51 +0000 (11:04 +0200)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 22 Aug 2025 09:04:51 +0000 (11:04 +0200)
Once the ld-shared tests run on both Solaris/SPARC and x86, two tests
XPASS on 32-bit Solaris, both SPARC and x86 (pre-existing on SPARC,
newly revealed on x86):

XPASS: shared (non PIC)
XPASS: shared (PIC main, non PIC so)

Consequently, this patch restricts xfailing them to 64-bit Solaris.

There now remain 1 (32-bit) or 3 (64-bit) XFAILs.  I've checked the
reasons and found all comments in shared.exp are wrong:

* The common one (SPARC and x86, 32 and 64-bit) is

XFAIL: shared (non PIC, load offset)

  The error is always the same:

ld.so.1: shnp: fatal: tmpdir/shnp.so: unknown file type

  Running shnp under truss reveals

26170:  openat(AT_FDCWD, "tmpdir/shnp.so", O_RDONLY)    = 3
26170:  mmapobj(3, MMOBJ_INTERPRET, 0xFFFFFFFF7F5D0058, 0xFFFFFFFF7FFFE8A0, 0x00000000) Err#48 ENOTSUP

  which can be traced in the mmapobj(2) implementation to the
  requirement that a shared object's p_vaddr needs to be 0, which in
  this test is intentionally not the case.

* The other two XFAIL's are 64-bit only and for another reason:

XFAIL: shared (non PIC)
XFAIL: shared (PIC main, non PIC so)

  On sparcv9, shnp execution fails:

ld.so.1: shnp: fatal: relocation error: R_SPARC_H44: file tmpdir/shnp.so: symbol shlibvar2: value 0x3fffffffb9c does not fit

  On amd64, shmpnp.so fails to link:

ld/tmpdir/ld/collect-ld: tmpdir/sh1np.o: relocation R_X86_64_32S against symbol `shlib_shlibvar1' can not be used when making a shared object; recompile with -fPIC
ld/tmpdir/ld/collect-ld: failed to set dynamic section sizes: bad value

  In both cases, this happens with -z text, too, so the comments are
  bogus.  Instead, the issue that the code needs to be PIC.

So I'm updating the comments accordingly.

Tested on sparc{v9,}-sun-solaris2.11 and {amd64,i386}-pc-solaris2.11.

2025-07-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
* testsuite/ld-shared/shared.exp (shared (non PIC)): Update
comment.  xfail on 64-bit Solaris only.
(shared (PIC main, non PIC so)): Likewise.
(shared (non PIC, load offset)): Update comment.

ld/ChangeLog
ld/testsuite/ld-shared/shared.exp

index 1cb8e89079c1b92e3697ea61a903d279e44fd131..175aea6a7a6262c4452fee0c4561427921dc9b7f 100644 (file)
@@ -1,3 +1,10 @@
+2025-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * testsuite/ld-shared/shared.exp (shared (non PIC)): Update
+       comment.  xfail on 64-bit Solaris only.
+       (shared (PIC main, non PIC so)): Likewise.
+       (shared (non PIC, load offset)): Update comment.
+
 2025-08-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * testsuite/ld-shared/shared.exp: Enable on *-*-solaris2* rather
index 6aa7ca937e2314fa73ca078fdfff1f7c3a42d533..c67084c0cf6f6f26e6c0992708df8d22bf0d0146 100644 (file)
@@ -230,8 +230,9 @@ if ![ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $
     } else { if { [is_xcoff_format] } {
        shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
     } else {
-       # Solaris defaults to -z text.
-       setup_xfail "*-*-solaris2*"
+       # 64-bit Solaris requires PIC.
+       setup_xfail "sparcv9*-*-solaris2*"
+       setup_xfail "x86_64-*-solaris2*"
        setup_xfail "ia64-*-linux*"
        setup_xfail "alpha*-*-linux*"
        setup_xfail "powerpc-*-linux-musl"
@@ -277,7 +278,7 @@ if ![ld_compile "$CC_FOR_TARGET $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $
            setup_xfail "arm*-*-linux*"
        }
        setup_xfail "aarch64*-*-linux*"
-       # Solaris defaults to -z text.
+       # Solaris refuses to map shared objects with non-zero load addresses.
        setup_xfail "*-*-solaris2*"
        shared_test shnp "shared (non PIC, load offset)" \
                mainnp.o sh1np.o sh2np.o shared \
@@ -312,8 +313,9 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdi
         if { [is_xcoff_format] } {
            shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff "" $NOPIE_LDFLAGS
        } else {
-           # Solaris defaults to -z text.
-           setup_xfail "*-*-solaris2*"
+           # 64-bit Solaris requires PIC.
+           setup_xfail "sparcv9*-*-solaris2*"
+           setup_xfail "x86_64-*-solaris2*"
            setup_xfail "ia64-*-linux*"
            setup_xfail "alpha*-*-linux*"
            setup_xfail "powerpc-*-linux-musl"