This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed, PATCH] Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Wed, 21 Jun 2017 15:24:00 -0700
- Subject: [committed, PATCH] Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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 | 6 ++++++
ld/testsuite/ld-elf/shared.exp | 19 +++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 555b7b4..94af73d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,6 +1,12 @@
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
* testsuite/ld-scripts/crossref.exp: Also pass $NOPIE_CFLAGS
to CC.
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 7c4e0a2..8b139ec 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -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" ] \
--
2.9.4