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

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