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

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