From patchwork Sat Oct 22 19:49:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 16743 Received: (qmail 117414 invoked by alias); 22 Oct 2016 19:49:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 117362 invoked by uid 89); 22 Oct 2016 19:49:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fsplitstack, fsplit-stack, Hx-languages-length:2814, unlink X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 22 Oct 2016 19:49:10 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7EB33B717 for ; Sat, 22 Oct 2016 19:49:09 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-204-42.brq.redhat.com [10.40.204.42]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9MJn6J6021762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 22 Oct 2016 15:49:09 -0400 Date: Sat, 22 Oct 2016 21:49:06 +0200 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [testsuite patch] Fix false FAIL for gdb.base/morestack.exp Message-ID: <20161022194906.GA18811@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes Hi, since [commit] [testsuite patch] Fix gcc_compiled for gcc 6 & 7 https://sourceware.org/ml/gdb-patches/2016-10/msg00620.html there has started running again Running gdb/testsuite/gdb.base/morestack.exp ... +FAIL: gdb.base/morestack.exp: continue +PASS: gdb.base/morestack.exp: up 3000 but as you can see it FAILs now - on Fedora 24 x86_64 (although for example it still PASSes on CentOS-7.2 x86_64). Program received signal SIGSEGV, Segmentation fault. 0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 ) at malloc.c:4181 4181 unlink(av, nextchunk, bck, fwd); (gdb) bt #0 0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 ) at malloc.c:4181 #1 0x00007ffff787f235 in _int_malloc (av=av@entry=0x7ffff7bbcb00 , bytes=bytes@entry=1024) at malloc.c:3448 [...] #8 0x00007ffff784c5ac in _IO_vfprintf_internal (s=0x7ffff7bbd600 <_IO_2_1_stdout_>, format=, ap=ap@entry=0x7ffff77fd7f8) at vfprintf.c:1631 #9 0x00007ffff7853939 in __printf (format=) at printf.c:33 #10 0x0000000000400d6b in down () #11 0x0000000000400f2c in __morestack () #12 0x0000000000400dda in down () [...] This apparently is due to - man gcc - -fsplit-stack: When code compiled with -fsplit-stack calls code compiled without -fsplit-stack, there may not be much stack space available for the latter code to run. If compiling all code, including library code, with -fsplit-stack is not an option, then the linker can fix up these calls so that the code compiled without -fsplit-stack always has a large stack. Support for this is implemented in the gold linker in GNU binutils release 2.21 and later. Personally I do not understand why gold is not the default linker as GNU ld is unusably slow (6x) for C++ but that is off-topic here. OK for check-in? Thanks, Jan gdb/testsuite/ChangeLog 2016-10-22 Jan Kratochvil * gdb.base/morestack.exp: Try to build it using -fuse-ld=gold first. diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp index 12f5d28..caa85b8 100644 --- a/gdb/testsuite/gdb.base/morestack.exp +++ b/gdb/testsuite/gdb.base/morestack.exp @@ -23,7 +23,11 @@ if {$gcc_compiled == 0} { standard_testfile -if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-fsplit-stack}] } { +# -fuse-ld=gold is used for calling printf code built without -fsplit-stack +# which could crash otherise. See GCC documentation of -fsplit-stack. +set opts "additional_flags=-fsplit-stack" +if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile [list $opts additional_flags=-fuse-ld=gold]] \ + && [prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts] } { return -1 }