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

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