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

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