[committed, PATCH] Set NOPIE_CFLAGS and NOPIE_LDFLAGS

H.J. Lu hongjiu.lu@intel.com
Wed Jul 29 17:53:00 GMT 2015


On Mon, Jul 27, 2015 at 04:21:33PM -0700, H.J. Lu wrote:
> GCC 6 can be configured to generate PIE by default.  But some linker
> size tests expect non-PIE.  This patch defines NOPIE_CFLAGS to
> "-fno-PIE" and NOPIE_LDFLAGS to "-no-pie" if target compiler supports
> them.  Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS to linker size tests if
> needed.
> 
> 	* config/default.exp (NOPIE_CFLAGS): New.
> 	(NOPIE_LDFLAGS): Likewise.
> 	* ld-size/size.exp (run_cc_link_tests): Add $NOPIE_CFLAGS and
> 	$NOPIE_LDFLAGS if needed.
> 	(run_ld_link_exec_tests): Add $NOPIE_CFLAGS if needed.

We must check run-time support for size relocation first before running
the tests.  Committed.

	* ld-size/size.exp: Move run-time support check.
---
 ld/testsuite/ChangeLog        |  4 ++++
 ld/testsuite/ld-size/size.exp | 28 ++++++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index d0b5daf..a9e5a7b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* ld-size/size.exp: Move run-time support check.
+
 2015-07-28  Alan Modra  <amodra@gmail.com>
 
 	* ld-powerpc/elfv2so.d: Update.
diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp
index 2a16c71..5a774fa 100644
--- a/ld/testsuite/ld-size/size.exp
+++ b/ld/testsuite/ld-size/size.exp
@@ -161,6 +161,20 @@ run_cc_link_tests [list \
     ] \
 ]
 
+# Check if size relocation works at run-time.
+catch "exec tmpdir/size-7.exe > tmpdir/dump.out" exec_output
+if ![string match "" $exec_output] then {
+    send_log "No run-time size relocation support: $exec_output\n"
+    verbose "No run-time size relocation support: $exec_output" 1
+    return
+}
+
+if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then {
+    verbose "output is [file_contents "tmpdir/dump.out"]" 2
+    fail "Run-time size relocation"
+    return
+}
+
 # Run-time size relocation tests.
 run_ld_link_exec_tests [] [list \
     [list \
@@ -295,17 +309,3 @@ run_ld_link_exec_tests [] [list \
 	"size-10.out" \
     ] \
 ]
-
-# Check if size relocation works at run-time.
-catch "exec tmpdir/size-7.exe > tmpdir/dump.out" exec_output
-if ![string match "" $exec_output] then {
-    send_log "No run-time size relocation support: $exec_output\n"
-    verbose "No run-time size relocation support: $exec_output" 1
-    return
-}
-
-if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then {
-    verbose "output is [file_contents "tmpdir/dump.out"]" 2
-    fail "Run-time size relocation"
-    return
-}
-- 
2.4.3



More information about the Binutils mailing list