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