From 68193357e8d0fb53a229114713db9f0385f60ed8 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 21 Jun 2017 14:45:16 -0700 Subject: Pass $NOPIE_LDFLAGS size tests PR ld/21090 * testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a, size-4b, size-5a, size-5b, size-6 and size-8 tests. --- ld/ChangeLog | 6 ++++++ ld/testsuite/ld-size/size.exp | 13 +++++++------ ld/testsuite/ld-srec/srec.exp | 9 +++++---- ld/testsuite/ld-x86-64/no-plt.exp | 9 ++++++--- ld/testsuite/ld-x86-64/x86-64.exp | 7 +++++-- 5 files changed, 29 insertions(+), 15 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index f146c3a..0885cd9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2017-06-21 H.J. Lu + + PR ld/21090 + * testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a, + size-4b, size-5a, size-5b, size-6 and size-8 tests. + 2017-06-21 Alan Modra * testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests. diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp index d4c3b8f..c4fa2c8 100644 --- a/ld/testsuite/ld-size/size.exp +++ b/ld/testsuite/ld-size/size.exp @@ -234,7 +234,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-4a" \ - "" \ + "$NOPIE_LDFLAGS" \ "" \ {size-4a.c size-4b.c} \ "size-4a" \ @@ -243,7 +243,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-4b" \ - "" \ + "$NOPIE_LDFLAGS" \ "" \ {size-4b.c size-4a.c} \ "size-4b" \ @@ -252,7 +252,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-5a" \ - "" \ + "$NOPIE_LDFLAGS" \ "" \ {size-5a.c size-5b.c} \ "size-5a" \ @@ -261,7 +261,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-5b" \ - "" \ + "$NOPIE_LDFLAGS" \ "" \ {size-5b.c size-5a.c} \ "size-5b" \ @@ -270,7 +270,7 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-6" \ - "-Wl,--no-as-needed tmpdir/libsize-6b.so" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-6b.so" \ "" \ {size-6a.c} \ "size-6" \ @@ -279,7 +279,8 @@ run_ld_link_exec_tests [list \ ] \ [list \ "Run size-8" \ - "-Wl,--no-as-needed,--hash-styl=gnu tmpdir/libsize-8.so" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu \ + tmpdir/libsize-8.so" \ "" \ {size-8a.c} \ "size-8" \ diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index 2720043..cb0b69b 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -351,12 +351,13 @@ if { ![is_remote host] && [which $CC] == 0 } { } # Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records -# tests. -global PLT_CFLAGS +# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work +# with S-records. +global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS set old_CC "$CC" -set CC "$CC $PLT_CFLAGS" +set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS" set old_CXX "$CXX" -set CXX "$CXX $PLT_CFLAGS" +set CXX "$CXX $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS" if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \ || ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } { diff --git a/ld/testsuite/ld-x86-64/no-plt.exp b/ld/testsuite/ld-x86-64/no-plt.exp index 9cecd03..84ca5b7 100644 --- a/ld/testsuite/ld-x86-64/no-plt.exp +++ b/ld/testsuite/ld-x86-64/no-plt.exp @@ -39,6 +39,9 @@ if { [which $CC] == 0 } { return } +# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required. +global NOPIE_CFLAGS NOPIE_LDFLAGS + run_cc_link_tests [list \ [list \ "Build no-plt-func1.o no-plt-main1.o" \ @@ -71,7 +74,7 @@ run_cc_link_tests [list \ ] \ [list \ "No PLT (dynamic 1a)" \ - "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ + "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \ "" \ {dummy.s} \ @@ -89,7 +92,7 @@ run_cc_link_tests [list \ ] \ [list \ "No PLT (dynamic 1c)" \ - "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ + "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \ "" \ {dummy.s} \ @@ -266,7 +269,7 @@ if { [check_ifunc_available] } { ] \ [list \ "Run pr20253-2f" \ - "tmpdir/pr20253-2a.o" \ + "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \ "" \ { pr20253-2b.S pr20253-2c.S pr20253-2d.S } \ "pr20253-2f" \ diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 48d8ad2..21f408d 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -815,7 +815,9 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Build gotpcrel1" \ - "-Wl,--as-needed tmpdir/gotpcrel1a.o tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o tmpdir/gotpcrel1d.so" \ + "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpcrel1a.o \ + tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o \ + tmpdir/gotpcrel1d.so" \ { dummy.s } \ "" \ {{objdump {-dw} gotpcrel1.dd}} \ @@ -1061,11 +1063,12 @@ if { [isnative] && [which $CC] != 0 } { ] \ [list \ "Run pr19031" \ - "-Wl,--no-as-needed tmpdir/pr19031.so" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr19031.so" \ "" \ { pr19031b.S pr19031c.c } \ "pr19031" \ "pr19031.out" \ + "$NOPIE_CFLAGS" \ ] \ [list \ "Run gotpcrel1" \ -- cgit v1.1