Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 22:22:05 +0000 (15:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 22:22:05 +0000 (15:22 -0700)
Some ELF tests will fail when PIE is used.

PR ld/21090
* testsuite/ld-elf/shared.exp: Pass $NOPIE_CFLAGS and
$NOPIE_LDFLAGS if non-PIE is required.

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

index 555b7b4e15dd61dad85471009cee95135cb1665c..94af73dfaab17ee990be4c3382867797d5661b45 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/21090
+       * testsuite/ld-elf/shared.exp: Pass $NOPIE_CFLAGS and
+       $NOPIE_LDFLAGS if non-PIE is required.
+
 2017-06-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/21090
index 7c4e0a2b39bc3b4b194d2cb488c941adee8ae577..8b139ec874dca570bafcbe49c4ece8c5546f2902 100644 (file)
@@ -31,6 +31,9 @@ if ![check_shared_lib_support] {
     return
 }
 
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
 # This target requires extra GAS options when building code for shared
 # libraries.
 set AFLAGS_PIC ""
@@ -554,8 +557,8 @@ set dlopen_run_tests [list \
      "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
      {dl6amain.c} "dl6a1" "dl6a.out" ] \
     [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
-     "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
-     {dl6amain.c} "dl6a2" "dl6b.out" ] \
+     "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
+     {dl6amain.c} "dl6a2" "dl6b.out" "$NOPIE_CFLAGS" ] \
     [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
      "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
      {dl6amain.c} "dl6a3" "dl6b.out" ] \
@@ -563,14 +566,14 @@ set dlopen_run_tests [list \
      "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
      {dl6amain.c} "dl6a4" "dl6a.out" ] \
     [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
-     "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
-     {dl6amain.c} "dl6a5" "dl6b.out" ] \
+     "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
+     {dl6amain.c} "dl6a5" "dl6b.out" "$NOPIE_CFLAGS" ] \
     [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
-     "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
-     {dl6amain.c} "dl6a6" "dl6b.out" ] \
+     "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
+     {dl6amain.c} "dl6a6" "dl6b.out" "$NOPIE_CFLAGS" ] \
     [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
-     "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
-     {dl6amain.c} "dl6a7" "dl6a.out" ] \
+     "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
+     {dl6amain.c} "dl6a7" "dl6a.out" "$NOPIE_CFLAGS" ] \
     [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
      "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
      {dl6bmain.c} "dl6b1" "dl6a.out" ] \