From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Charles Stanhope Newsgroups: gmane.lisp.guile.devel Subject: Re: Segfault while building on 64-bit Cygwin Date: Fri, 14 Feb 2020 09:46:04 -0800 Message-ID: References: <87zherlphs.fsf@pobox.com> <875zh6gk72.fsf_-_@gnu.org> <20200120172253.GA1112065@spikycactus.com> <87wo90kmw9.fsf@pobox.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000a91504059e8cc7c2" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="109889"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39118@debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= , John Cowan , guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Feb 14 18:46:35 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 1j2f2x-000SQe-Dr for guile-devel@m.gmane-mx.org; Fri, 14 Feb 2020 18:46:35 +0100 Original-Received: from localhost ([::1]:42464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2f2w-0004Yx-8C for guile-devel@m.gmane-mx.org; Fri, 14 Feb 2020 12:46:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55057) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2f2a-0004Yg-7J for guile-devel@gnu.org; Fri, 14 Feb 2020 12:46:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2f2Y-00045X-Nw for guile-devel@gnu.org; Fri, 14 Feb 2020 12:46:12 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:40301) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j2f2Y-00043P-DV for guile-devel@gnu.org; Fri, 14 Feb 2020 12:46:10 -0500 X-Originating-IP: 209.85.167.41 Original-Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (Authenticated sender: charles@stanho.pe) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0F3FF6000D for ; Fri, 14 Feb 2020 17:46:06 +0000 (UTC) Original-Received: by mail-lf1-f41.google.com with SMTP id 9so7290023lfq.10 for ; Fri, 14 Feb 2020 09:46:06 -0800 (PST) X-Gm-Message-State: APjAAAXPqpOsfHKZ1nDiTAI0BS4Da8Q5naoo4Anhx35pLyk9egsvoNJQ LRVTaOMNhn3hP4mnO78/fmoNrhdgWLe5hsGGzfkyIw== X-Google-Smtp-Source: APXvYqyLcyhTaW5VEOz02AZCgv1mMwA4m54W6TmECKQzSbh9yUkOl8lM/zGUT2dp8bKdzx14slIHeuAncHKkQeQ1lKQ= X-Received: by 2002:ac2:4a91:: with SMTP id l17mr2216891lfp.75.1581702365898; Fri, 14 Feb 2020 09:46:05 -0800 (PST) Original-Received: by 2002:ab3:6883:0:0:0:0:0 with HTTP; Fri, 14 Feb 2020 09:46:04 -0800 (PST) X-Originating-IP: [50.45.151.166] In-Reply-To: X-Gmail-Original-Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.195 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:20414 Archived-At: --000000000000a91504059e8cc7c2 Content-Type: text/plain; charset="UTF-8" On 2/6/20, Charles Stanhope wrote: > On 2/6/20, Andy Wingo wrote: > >> Given that John said that compilation went fine with >> GUILE_JIT_THRESHOLD=-1, I think perhaps this problem may have been fixed >> in the past. My suspicions are that this issue is an ABI issue with >> lightening that could perhaps be reproduced by: >> >> git co https://gitlab.com/wingo/lightening >> cd lightening >> make -C tests test-native >> >> Of course any additional confirmation is useful and welcome! > > I haven't been able to get guile to compile under Cygwin (just a > compilation error I haven't had time to track down), but I was able to > quickly try the above. I get: > > Testing: test-native-call_10 > call_10.c:9: assertion failed: e == 4 > /bin/sh: line 1: 7063 Aborted (core dumped) ./$test > make: *** [Makefile:31: test-native] Error 134 > Andy, I don't know if you'd want to continue this here or on lightening's gitlab page, but I looked into this a little bit a few minutes here and there this past weeek. The x86 "fast-call" calling convention used on Windows x64[0] and shared by Cygwin[1] requires that the caller reserve 32 bytes of memory on the stack for the callee to spill the register parameters (even if the callee takes fewer than four parameters). I think lightening is currently missing that for the x64 case for Cygwin. To test the idea, I made a small modification (patch attached) that is *not* intended as a solution as it doesn't work for the general case, but it does allow the tests to pass on Cygwin 64. [0] https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019 [1] https://cygwin.com/cygwin-ug-net/programming.html#gcc-64 -- Charles --000000000000a91504059e8cc7c2 Content-Type: text/x-patch; charset="US-ASCII"; name="x86-fastcall-stack-reservation.patch" Content-Disposition: attachment; filename="x86-fastcall-stack-reservation.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: file1 ZGlmZiAtLWdpdCBhL2xpZ2h0ZW5pbmcveDg2LmMgYi9saWdodGVuaW5nL3g4Ni5jCmluZGV4IDk2 NTE5MWEuLjkxYjNhOTQgMTAwNjQ0Ci0tLSBhL2xpZ2h0ZW5pbmcveDg2LmMKKysrIGIvbGlnaHRl bmluZy94ODYuYwpAQCAtMzM4LDExICszMzgsMTMgQEAgbmV4dF9hYmlfYXJnKHN0cnVjdCBhYmlf YXJnX2l0ZXJhdG9yICppdGVyLCBqaXRfb3BlcmFuZF90ICphcmcpCiAgIGlmIChpc19ncHJfYXJn KGFiaSkgJiYgaXRlci0+Z3ByX2lkeCA8IGFiaV9ncHJfYXJnX2NvdW50KSB7CiAgICAgKmFyZyA9 IGppdF9vcGVyYW5kX2dwciAoYWJpLCBhYmlfZ3ByX2FyZ3NbaXRlci0+Z3ByX2lkeCsrXSk7CiAj aWZkZWYgX19DWUdXSU5fXworICAgIGl0ZXItPnN0YWNrX3NpemUgKz0gODsKICAgICBpdGVyLT5m cHJfaWR4Kys7CiAjZW5kaWYKICAgfSBlbHNlIGlmIChpc19mcHJfYXJnKGFiaSkgJiYgaXRlci0+ ZnByX2lkeCA8IGFiaV9mcHJfYXJnX2NvdW50KSB7CiAgICAgKmFyZyA9IGppdF9vcGVyYW5kX2Zw ciAoYWJpLCBhYmlfZnByX2FyZ3NbaXRlci0+ZnByX2lkeCsrXSk7CiAjaWZkZWYgX19DWUdXSU5f XworICAgIGl0ZXItPnN0YWNrX3NpemUgKz0gODsKICAgICBpdGVyLT5ncHJfaWR4Kys7CiAjZW5k aWYKICAgfSBlbHNlIHsK --000000000000a91504059e8cc7c2--