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

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