From 6b7373708821500a7388a8248b6c19fa1826c514 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 21 Jun 2017 15:22:05 -0700 Subject: [PATCH] Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests 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 555b7b4e15d..94af73dfaab 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2017-06-21 H.J. Lu + + 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 PR ld/21090 diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 7c4e0a2b39b..8b139ec874d 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.30.2