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

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