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

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