From 7218d159e36f6513ec61ce2d2878d60e2b5ea462 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 11 Oct 2011 17:11:36 +0200 Subject: [PATCH] Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE. --- gdb-runtest-pie-override.patch | 40 ++++++++++++++++++++++++++++++++++ gdb.spec | 12 ++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 gdb-runtest-pie-override.patch diff --git a/gdb-runtest-pie-override.patch b/gdb-runtest-pie-override.patch new file mode 100644 index 0000000..dc54494 --- /dev/null +++ b/gdb-runtest-pie-override.patch @@ -0,0 +1,40 @@ +make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp + +gcc -fpic -c -fPIE -pie -o x.o x.c +/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start': +(.text+0x20): undefined reference to `main' + +=> Change the order for overrides. + +One has to also use -fPIC rather than -fPIE, -fPIC is stronger. + +The correct way would be: +make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp' + +But there is a problem with testsuite.unix non-unique subdir name and also +a problem with make -j parallelization of the testsuite. + +--- gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp 2011-10-11 16:44:05.000000000 +0200 ++++ gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp2 2011-10-11 16:44:10.000000000 +0200 +@@ -77,6 +77,10 @@ proc gdb_default_target_compile {source + set ldflags "" + set dest [target_info name] + ++ if {[board_info $dest exists multilib_flags]} { ++ append add_flags " [board_info $dest multilib_flags]" ++ } ++ + if {[info exists CFLAGS_FOR_TARGET]} { + append add_flags " $CFLAGS_FOR_TARGET" + } +@@ -333,10 +337,6 @@ proc gdb_default_target_compile {source + } + } + +- if {[board_info $dest exists multilib_flags]} { +- append add_flags " [board_info $dest multilib_flags]" +- } +- + verbose "doing compile" + + set sources "" diff --git a/gdb.spec b/gdb.spec index 502b161..269c63f 100644 --- a/gdb.spec +++ b/gdb.spec @@ -27,7 +27,7 @@ Version: 7.3.50.20110722 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 7%{?_with_upstream:.upstream}%{?dist} +Release: 8%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain Group: Development/Debuggers @@ -553,6 +553,9 @@ Patch631: gdb-implptr-64bit-2of2.patch # Fix internal error on some optimized-out values. Patch632: gdb-optimized-out-internal-error.patch +# Hack for proper PIE run of the testsuite. +Patch634: gdb-runtest-pie-override.patch + BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} # --without-system-readline # Requires: readline%{?_isa} @@ -825,6 +828,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch630 -p1 %patch631 -p1 %patch632 -p1 +%patch634 -p1 %patch393 -p1 %patch335 -p1 @@ -1064,7 +1068,8 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 %if 0%{!?_with_upstream:1} # Run all the scheduled testsuite runs also in the PIE mode. # Upstream GDB would lock up the testsuite run for too long on its failures. - CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIE/-pie#g')" + # See also: gdb-runtest-pie-override.exp + CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')" %endif # 0%{!?_with_upstream:1} ./orphanripper make %{?_smp_mflags} -k $CHECK \ @@ -1247,6 +1252,9 @@ fi %{_infodir}/gdb.info* %changelog +* Tue Oct 11 2011 Jan Kratochvil - 7.3.50.20110722-8.fc16 +- Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE. + * Mon Sep 26 2011 Jan Kratochvil - 7.3.50.20110722-7.fc16 - [vla] Fix VLA arrays displayed in `bt full' (BZ 738482). - Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches.