Blame SOURCES/gdb-testsuite-morestack-gold.patch

99f0af
http://sourceware.org/ml/gdb-patches/2016-10/msg00652.html
99f0af
Subject: [testsuite patch] Fix false FAIL for gdb.base/morestack.exp
99f0af
99f0af
99f0af
--HlL+5n6rz5pIUxbD
99f0af
Content-Type: text/plain; charset=us-ascii
99f0af
Content-Disposition: inline
99f0af
99f0af
Hi,
99f0af
99f0af
since
99f0af
	[commit] [testsuite patch] Fix gcc_compiled for gcc 6 & 7
99f0af
	https://sourceware.org/ml/gdb-patches/2016-10/msg00620.html
99f0af
99f0af
there has started running again
99f0af
	 Running gdb/testsuite/gdb.base/morestack.exp ...
99f0af
	+FAIL: gdb.base/morestack.exp: continue
99f0af
	+PASS: gdb.base/morestack.exp: up 3000
99f0af
99f0af
but as you can see it FAILs now - on Fedora 24 x86_64 (although for example it
99f0af
still PASSes on CentOS-7.2 x86_64).
99f0af
99f0af
Program received signal SIGSEGV, Segmentation fault.
99f0af
0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
99f0af
4181		      unlink(av, nextchunk, bck, fwd);
99f0af
(gdb) bt
99f0af
#0  0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
99f0af
#1  0x00007ffff787f235 in _int_malloc (av=av@entry=0x7ffff7bbcb00 <main_arena>, bytes=bytes@entry=1024) at malloc.c:3448
99f0af
[...]
99f0af
#8  0x00007ffff784c5ac in _IO_vfprintf_internal (s=0x7ffff7bbd600 <_IO_2_1_stdout_>, format=<optimized out>, ap=ap@entry=0x7ffff77fd7f8) at vfprintf.c:1631
99f0af
#9  0x00007ffff7853939 in __printf (format=<optimized out>) at printf.c:33
99f0af
#10 0x0000000000400d6b in down ()
99f0af
#11 0x0000000000400f2c in __morestack ()
99f0af
#12 0x0000000000400dda in down ()
99f0af
[...]
99f0af
99f0af
This apparently is due to - man gcc - -fsplit-stack:
99f0af
	When code compiled with -fsplit-stack calls code compiled without
99f0af
	-fsplit-stack, there may not be much stack space available for the
99f0af
	latter code to run.  If compiling all code, including library code,
99f0af
	with -fsplit-stack is not an option, then the linker can fix up these
99f0af
	calls so that the code compiled without -fsplit-stack always has
99f0af
	a large stack.  Support for this is implemented in the gold linker in
99f0af
	GNU binutils release 2.21 and later.
99f0af
99f0af
Personally I do not understand why gold is not the default linker as GNU ld is
99f0af
unusably slow (6x) for C++ but that is off-topic here.
99f0af
99f0af
OK for check-in?
99f0af
99f0af
99f0af
Thanks,
99f0af
Jan
99f0af
99f0af
--HlL+5n6rz5pIUxbD
99f0af
Content-Type: text/plain; charset=us-ascii
99f0af
Content-Disposition: inline; filename=1
99f0af
99f0af
gdb/testsuite/ChangeLog
99f0af
2016-10-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
99f0af
99f0af
	* gdb.base/morestack.exp: Try to build it using -fuse-ld=gold first.
99f0af
99f0af
diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp
99f0af
index 12f5d28..caa85b8 100644
99f0af
--- a/gdb/testsuite/gdb.base/morestack.exp
99f0af
+++ b/gdb/testsuite/gdb.base/morestack.exp
99f0af
@@ -23,7 +23,11 @@ if {$gcc_compiled == 0} {
99f0af
 
99f0af
 standard_testfile
99f0af
 
99f0af
-if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-fsplit-stack}] } {
99f0af
+# -fuse-ld=gold is used for calling printf code built without -fsplit-stack
99f0af
+# which could crash otherise.  See GCC documentation of -fsplit-stack.
99f0af
+set opts "additional_flags=-fsplit-stack"
99f0af
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile [list $opts additional_flags=-fuse-ld=gold]] \
99f0af
+     && [prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts] } {
99f0af
     return -1
99f0af
 }
99f0af
 
99f0af
99f0af
--HlL+5n6rz5pIUxbD--
99f0af