ld: xfail several shared (non PIC) tests on Solaris

Message ID yddk12oohjn.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series
  • ld: xfail several shared (non PIC) tests on Solaris
Related show

Commit Message

Rainer Orth April 9, 2020, 2:33 p.m.
Three ld tests currently FAIL on Solaris/SPARC:

FAIL: shared (non PIC)
FAIL: shared (non PIC, load offset)
FAIL: shared (PIC main, non PIC so)

all of them in the same way:

/var/gcc/binutils/sparcv7/obj/binutils/ld/tmpdir/ld/collect-ld: read-only segment has dynamic relocations

Given that Solaris defaults to -z text, this is to be expected, thus
this patch xfail's them.

The failures don't happen on Solaris/x86 which should have the same
issue.  However, shared.exp is guarded by an explicit target list which
includes Solaris/SPARC but not x86.  I mean to revisit such needless
asymmetries once I've cut down the current failures a bit.

Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.

Ok for master?

	Rainer

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


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

	* testsuite/ld-shared/shared.exp: Remove dangling comments.
	xfail shared non PIC tests on Solaris.

Comments

Peter Bergner via Binutils April 9, 2020, 2:45 p.m. | #1
Hi Rainer,

> Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.

> 

> Ok for master?


Approved - please apply.

Cheers
  Nick
Fangrui Song April 10, 2020, 2 a.m. | #2
On 2020-04-09, Rainer Orth wrote:
>Three ld tests currently FAIL on Solaris/SPARC:

>

>FAIL: shared (non PIC)

>FAIL: shared (non PIC, load offset)

>FAIL: shared (PIC main, non PIC so)

>

>all of them in the same way:

>

>/var/gcc/binutils/sparcv7/obj/binutils/ld/tmpdir/ld/collect-ld: read-only segment has dynamic relocations

>

>Given that Solaris defaults to -z text, this is to be expected, thus

>this patch xfail's them.


https://sourceware.org/bugzilla/show_bug.cgi?id=25694#c3

I think we can simply default to -z text for every platform.
If a text relocation is required, emit a friendly diagnostic
"... recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output"

>The failures don't happen on Solaris/x86 which should have the same

>issue.  However, shared.exp is guarded by an explicit target list which

>includes Solaris/SPARC but not x86.  I mean to revisit such needless

>asymmetries once I've cut down the current failures a bit.

>

>Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.

>

>Ok for master?

>

>	Rainer

>

>-- 

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

>Rainer Orth, Center for Biotechnology, Bielefeld University

>

>

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

>

>	* testsuite/ld-shared/shared.exp: Remove dangling comments.

>	xfail shared non PIC tests on Solaris.

>

Patch

# HG changeset patch
# Parent  e6e60586a85d5bcd0a92aeb6267c8933ffaa8b9f
ld: xfail several shared (non PIC) tests on Solaris

diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -222,8 +222,8 @@  if ![ld_compile "$CC $CFLAGS $SHCFLAG" $
     } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
 	shared_test shnp "shared (nonPIC)" mainnp.o sh1np.o sh2np.o xcoff
     } else {
-	# SunOS non PIC shared libraries don't permit some cases of
-	# overriding.
+	# Solaris defaults to -z text.
+	setup_xfail "*-*-solaris2*"
 	setup_xfail "ia64-*-linux*"
 	setup_xfail "alpha*-*-linux*"
 	setup_xfail "powerpc64*-*-*"
@@ -268,6 +268,8 @@  if ![ld_compile "$CC $CFLAGS $SHCFLAG" $
 	    setup_xfail "arm*-*-linux*"
 	}
 	setup_xfail "aarch64*-*-linux*"
+	# Solaris defaults to -z text.
+	setup_xfail "*-*-solaris2*"
 	shared_test shnp "shared (non PIC, load offset)" \
 		mainnp.o sh1np.o sh2np.o shared \
 		"-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
@@ -301,8 +303,8 @@  if ![ld_compile "$CC $CFLAGS $SHCFLAG $p
         if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
 	    shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
 	} else {
-	    # SunOS non PIC shared libraries don't permit some cases of
-	    # overriding.
+	    # Solaris defaults to -z text.
+	    setup_xfail "*-*-solaris2*"
 	    setup_xfail "ia64-*-linux*"
 	    setup_xfail "alpha*-*-linux*"
 	    setup_xfail "powerpc64*-*-*"