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.devel Subject: Re: Segfault while building on 64-bit Cygwin Date: Mon, 17 Feb 2020 22:05:45 +0100 Message-ID: <87blpwj55i.fsf@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="13714"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: John Cowan , Ludovic =?utf-8?Q?Court=C3=A8s?= , 39118-done@debbugs.gnu.org, guile-devel@gnu.org To: Charles Stanhope Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Feb 17 22:06:16 2020 Return-path: Envelope-to: guile-devel@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 1j3naq-0003Sp-Cx for guile-devel@m.gmane-mx.org; Mon, 17 Feb 2020 22:06:16 +0100 Original-Received: from localhost ([::1]:53068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3nap-0001jG-CL for guile-devel@m.gmane-mx.org; Mon, 17 Feb 2020 16:06:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40922) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3nae-0001iu-6X for guile-devel@gnu.org; Mon, 17 Feb 2020 16:06:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3nad-0007D7-5y for guile-devel@gnu.org; Mon, 17 Feb 2020 16:06:04 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:49745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3nac-0007C1-Il; Mon, 17 Feb 2020 16:06:03 -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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20422 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