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

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