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.bugs Subject: bug#39118: 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="113262"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39118@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= , guile-devel@gnu.org, Mike Gran To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Fri Feb 14 18:47:09 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 1j2f3V-000TJS-5I for guile-bugs@m.gmane-mx.org; Fri, 14 Feb 2020 18:47:09 +0100 Original-Received: from localhost ([::1]:42466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2f3U-0004pt-79 for guile-bugs@m.gmane-mx.org; Fri, 14 Feb 2020 12:47:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55196) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2f3P-0004pj-D8 for bug-guile@gnu.org; Fri, 14 Feb 2020 12:47:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2f3O-0004rN-8q for bug-guile@gnu.org; Fri, 14 Feb 2020 12:47:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2f3O-0004rI-5h for bug-guile@gnu.org; Fri, 14 Feb 2020 12:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j2f3O-0006FU-3E for bug-guile@gnu.org; Fri, 14 Feb 2020 12:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Charles Stanhope Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 14 Feb 2020 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39118 X-GNU-PR-Package: guile Original-Received: via spool by 39118-submit@debbugs.gnu.org id=B39118.158170237123954 (code B ref 39118); Fri, 14 Feb 2020 17:47:02 +0000 Original-Received: (at 39118) by debbugs.gnu.org; 14 Feb 2020 17:46:11 +0000 Original-Received: from localhost ([127.0.0.1]:34645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2f2Y-0006EH-H5 for submit@debbugs.gnu.org; Fri, 14 Feb 2020 12:46:10 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:52603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2f2W-0006E9-J5 for 39118@debbugs.gnu.org; Fri, 14 Feb 2020 12:46:09 -0500 Original-Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (Authenticated sender: charles@stanho.pe) by relay11.mail.gandi.net (Postfix) with ESMTPSA id CD917100004 for <39118@debbugs.gnu.org>; Fri, 14 Feb 2020 17:46:06 +0000 (UTC) Original-Received: by mail-lf1-f43.google.com with SMTP id r14so7302322lfm.5 for <39118@debbugs.gnu.org>; Fri, 14 Feb 2020 09:46:06 -0800 (PST) X-Gm-Message-State: APjAAAUOt09S82tE26s3q9G9Hcrmsg/68peMwG4z7GrntyEYx15NEh1u cCwRNWu0XiEWT5Yq/p1dVVwzWVWNSR4X9j2PW2j8/Q== 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-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:9575 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--