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

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