Pass $NOPIE_LDFLAGS size tests
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 21:45:16 +0000 (14:45 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 21:45:57 +0000 (14:45 -0700)
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
ld/testsuite/ld-size/size.exp
ld/testsuite/ld-srec/srec.exp
ld/testsuite/ld-x86-64/no-plt.exp
ld/testsuite/ld-x86-64/x86-64.exp

index f146c3a69f27a39ab48526344217e5af41cfeffc..0885cd997285b9012c55d480924cc9c30e3c4535 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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  <amodra@gmail.com>
 
        * testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests.
index d4c3b8f9ca5c191dde8177b923ecea723d505146..c4fa2c8f16a60e842ead1ace0e56d62c64789514 100644 (file)
@@ -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" \
index 2720043d9188af53aa5b749490c7059277391a38..cb0b69bdf12607bae779fb305158478e41753611 100644 (file)
@@ -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] } {
index 9cecd035381d9aed08e4c73316ba5ae03ca9466c..84ca5b7ed2167380039c1f28ab2c13ca7f6a2d2f 100644 (file)
@@ -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" \
index 48d8ad2c6757a6a6f637f2d6f4004ed80ce4041a..21f408d27dbec4844e66ed804ccf455b5b5151a1 100644 (file)
@@ -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" \