Blame SOURCES/gdb-runtest-pie-override.patch

ed07ac
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
ed07ac
From: Fedora GDB patches <invalid@email.com>
ed07ac
Date: Fri, 27 Oct 2017 21:07:50 +0200
ed07ac
Subject: gdb-runtest-pie-override.patch
ed07ac
ed07ac
;; Hack for proper PIE run of the testsuite.
ed07ac
;;=fedoratest
ed07ac
ed07ac
make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp
ed07ac
ed07ac
gcc -fpic -c  -fPIE -pie -o x.o x.c
ed07ac
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start':
ed07ac
(.text+0x20): undefined reference to `main'
ed07ac
ed07ac
=> Change the order for overrides.
ed07ac
ed07ac
One has to also use -fPIC rather than -fPIE, -fPIC is stronger.
ed07ac
ed07ac
The correct way would be:
ed07ac
make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp'
ed07ac
ed07ac
But there is a problem with testsuite.unix non-unique subdir name and also
ed07ac
a problem with make -j parallelization of the testsuite.
ed07ac
ed07ac
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
ed07ac
--- a/gdb/testsuite/lib/future.exp
ed07ac
+++ b/gdb/testsuite/lib/future.exp
ed07ac
@@ -197,6 +197,10 @@ proc gdb_default_target_compile_1 {source destfile type options} {
ed07ac
     set ldflags ""
ed07ac
     set dest [target_info name]
ed07ac
 
ed07ac
+    if {[board_info $dest exists multilib_flags]} {
ed07ac
+	append add_flags " [board_info $dest multilib_flags]"
ed07ac
+    }
ed07ac
+
ed07ac
     if {[info exists CFLAGS_FOR_TARGET]} {
ed07ac
 	append add_flags " $CFLAGS_FOR_TARGET"
ed07ac
     }
ed07ac
@@ -531,10 +535,6 @@ proc gdb_default_target_compile_1 {source destfile type options} {
ed07ac
 	}
ed07ac
     }
ed07ac
 
ed07ac
-    if {[board_info $dest exists multilib_flags]} {
ed07ac
-	append add_flags " [board_info $dest multilib_flags]"
ed07ac
-    }
ed07ac
-
ed07ac
     verbose "doing compile"
ed07ac
 
ed07ac
     set sources ""