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

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