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