From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#39118: Segfault while building on 64-bit Cygwin Date: Mon, 17 Feb 2020 22:05:45 +0100 Message-ID: <87blpwj55i.fsf__4640.62241824053$1581973637$gmane$org@pobox.com> References: <87zherlphs.fsf@pobox.com> <875zh6gk72.fsf_-_@gnu.org> <20200120172253.GA1112065@spikycactus.com> <87wo90kmw9.fsf@pobox.com> <20200216232334.GA2448000@spikycactus.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="18411"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Mike Gran , Ludovic =?UTF-8?Q?Court=C3=A8s?= , guile-devel@gnu.org, 39118-done@debbugs.gnu.org To: Charles Stanhope Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Feb 17 22:07:12 2020 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j3nbg-0004YY-Pu for guile-bugs@m.gmane-mx.org; Mon, 17 Feb 2020 22:07:08 +0100 Original-Received: from localhost ([::1]:53076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3nbf-0001zu-SS for guile-bugs@m.gmane-mx.org; Mon, 17 Feb 2020 16:07:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41052) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3nbb-0001zi-AV for bug-guile@gnu.org; Mon, 17 Feb 2020 16:07:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3nba-0007lx-8O for bug-guile@gnu.org; Mon, 17 Feb 2020 16:07:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3nba-0007ln-5Z for bug-guile@gnu.org; Mon, 17 Feb 2020 16:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j3nba-0004yH-1J for bug-guile@gnu.org; Mon, 17 Feb 2020 16:07:02 -0500 Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Mon, 17 Feb 2020 21:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 39118 X-GNU-PR-Package: guile Mail-Followup-To: 39118@debbugs.gnu.org, wingo@pobox.com, cowan@ccil.org Original-Received: via spool by 39118-done@debbugs.gnu.org id=D39118.158197356819046 (code D ref 39118); Mon, 17 Feb 2020 21:07:01 +0000 Original-Received: (at 39118-done) by debbugs.gnu.org; 17 Feb 2020 21:06:08 +0000 Original-Received: from localhost ([127.0.0.1]:39304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3nai-0004x8-HY for submit@debbugs.gnu.org; Mon, 17 Feb 2020 16:06:08 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:46581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3nad-0004wc-LX for 39118-done@debbugs.gnu.org; Mon, 17 Feb 2020 16:06:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=LxGzCQaKkZA5qfUp7QE4jpDPpH/eripHDjTQ14pVPCc=; b=XqHczwpzVo6tZAMIR17tNaykxM4pc+cyzhbXV/eJEZQSznnVWa4imMYHiSVic3i1DfNRjC9Se/f56Rc7U1quZYe80apO/fCBUCAy5KYJ1y2g4ofaKdj4lO9RzKS+jAiHA53GA/M9h2MKa5IwQDTSkYqFH9n3MOc1FBf/O2ma5aygJd74405L0v94iAUvdafQcamiIJHuiKhRyFn7wvNTiuhidYdjL/I9kThwDzGd/hq8k3VSa+/e1CTFkE5E3nuqhM+ZTg8TkxsCafh1Ch7OBJ0aYPBjkKDcuP7Ux9LbZ1nj/uQRTGghGz0Au3wmsnoh+rhsDbDZORL4rfU5FuEaNA==; Original-Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1j3naV-0002aV-Ku; Mon, 17 Feb 2020 22:05:55 +0100 In-Reply-To: (Charles Stanhope's message of "Mon, 17 Feb 2020 11:27:42 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9586 Archived-At: Aah, you all are amazing -- thank you!! Applied and merged. Cheers, Andy On Mon 17 Feb 2020 20:27, Charles Stanhope writes: > On 2/16/20, Charles Stanhope wrote: >> On 2/16/20, Mike Gran wrote: >>> >>> I can confirm that Charles's patch, plus another one line patch >>> to define CPU_SETSIZE, is enough to get Guile 3.0.x to build and run >>> on my box. All tests pass except strptime in French, and the absence >>> of crypt. This is a 64-bit build. >> >> Mike, thanks for going further with the Guile build. The CPU_SETSIZE >> issue was what was hanging me up from compiling before Andy's comment >> got me to look at lightening. I assumed I had some configuration, >> package, or compiler issue. Good to know there's a simple fix. >> >> Just a further warning to anyone watching, that patch I posted is a >> real hack job just to test my theory of the cause of the segfault. I >> would expect it to fail when you have fewer than four arguments in a >> JITed function call. I wouldn't try doing much else with that Guile >> build besides run the tests. :) > > I had a little bit more time to look into the lightening > implementation last night. I've attached a patch that is less horrible > and more correct than my previous one. It reserves the stack space > regardless of the number of parameters and appears to work. But I'm > new to the lightening code base, so I'm not convinced it is the > correct solution. It's just the solution I was left with after my time > ran out. I wanted to post this patch as a replacement to the prior one > in case people did want to do more testing with Guile 3.0 on Cygwin > x64. > > With that, I will let more experienced people come up with the > appropriate solution. Happy hacking, everybody! > > -- > Charles > > diff --git a/lightening/x86.c b/lightening/x86.c > index 965191a..bdd26e1 100644 > --- a/lightening/x86.c > +++ b/lightening/x86.c > @@ -328,6 +328,10 @@ reset_abi_arg_iterator(struct abi_arg_iterator *iter, size_t argc, > memset(iter, 0, sizeof *iter); > iter->argc = argc; > iter->args = args; > +#if __CYGWIN__ && __X64 > + // Reserve slots on the stack for 4 register parameters (8 bytes each). > + iter->stack_size = 32; > +#endif > } > > static void