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

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