pr18841 tests on powerpc64

Message ID 20200709132624.GB25751@bubble.grove.modra.org
State New
Headers show
Series
  • pr18841 tests on powerpc64
Related show

Commit Message

David Faust via Binutils July 9, 2020, 1:26 p.m.
The PR18841 test does cross-module calls from within an ifunc
resolver, which is nasty, and not supported in general since the
called function may not be relocated.  In this case the called
function (zoo) is just a stub so doesn't need relocating, but on ppc64
the function descriptor for zoo in the executable won't be relocated
at the time the shared library ifunc resolver runs.  That means the
test will fail if your compiler generates PIEs by default.

	PR 18841
	* testsuite/ld-ifunc/ifunc.exp: Run pr18841 tests non-pie.


-- 
Alan Modra
Australia Development Lab, IBM

Comments

Matthias Klose July 13, 2020, 1:20 p.m. | #1
On 7/9/20 3:26 PM, Alan Modra wrote:
> The PR18841 test does cross-module calls from within an ifunc

> resolver, which is nasty, and not supported in general since the

> called function may not be relocated.  In this case the called

> function (zoo) is just a stub so doesn't need relocating, but on ppc64

> the function descriptor for zoo in the executable won't be relocated

> at the time the shared library ifunc resolver runs.  That means the

> test will fail if your compiler generates PIEs by default.

> 

> 	PR 18841

> 	* testsuite/ld-ifunc/ifunc.exp: Run pr18841 tests non-pie.



please could you commit this to the 2.35 branch as well?

Thanks, Matthias
David Faust via Binutils July 13, 2020, 2:27 p.m. | #2
On Mon, Jul 13, 2020 at 03:20:21PM +0200, Matthias Klose wrote:
> On 7/9/20 3:26 PM, Alan Modra wrote:

> > The PR18841 test does cross-module calls from within an ifunc

> > resolver, which is nasty, and not supported in general since the

> > called function may not be relocated.  In this case the called

> > function (zoo) is just a stub so doesn't need relocating, but on ppc64

> > the function descriptor for zoo in the executable won't be relocated

> > at the time the shared library ifunc resolver runs.  That means the

> > test will fail if your compiler generates PIEs by default.

> > 

> > 	PR 18841

> > 	* testsuite/ld-ifunc/ifunc.exp: Run pr18841 tests non-pie.

> 

> 

> please could you commit this to the 2.35 branch as well?


and done.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
index 08cc87875c..f67808c266 100644
--- a/ld/testsuite/ld-ifunc/ifunc.exp
+++ b/ld/testsuite/ld-ifunc/ifunc.exp
@@ -559,7 +559,7 @@  run_cc_link_tests [list \
     [list \
 	"Build pr18841a.o" \
 	"" \
-	"" \
+	"$NOPIE_CFLAGS" \
 	{ pr18841a.c } \
 	"" \
 	"" \
@@ -687,32 +687,32 @@  run_ld_link_exec_tests [list \
     ] \
     [list \
 	"Run pr18841 with libpr18841b.so" \
-	"-Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841b.so" \
-	"" \
+	"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841b.so" \
+	"$NOPIE_CFLAGS" \
 	{ dummy.c } \
 	"pr18841b" \
 	"pr18841.out" \
     ] \
     [list \
 	"Run pr18841 with libpr18841c.so" \
-	"-Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \
-	"" \
+	"$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841c.so" \
+	"$NOPIE_CFLAGS" \
 	{ dummy.c } \
 	"pr18841c" \
 	"pr18841.out" \
     ] \
     [list \
 	"Run pr18841 with libpr18841bn.so (-z now)" \
-	"-Wl,-z,now -Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841bn.so" \
-	"" \
+	"$NOPIE_LDFLAGS -Wl,-z,now -Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841bn.so" \
+	"$NOPIE_CFLAGS" \
 	{ dummy.c } \
 	"pr18841bn" \
 	"pr18841.out" \
     ] \
     [list \
 	"Run pr18841 with libpr18841cn.so (-z now)" \
-	"-Wl,-z,now -Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841cn.so" \
-	"" \
+	"$NOPIE_LDFLAGS -Wl,-z,now -Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841cn.so" \
+	"$NOPIE_CFLAGS" \
 	{ dummy.c } \
 	"pr18841cn" \
 	"pr18841.out" \