From: Charles Stanhope <charles@stanho.pe>
To: Andy Wingo <wingo@pobox.com>
Cc: 39118@debbugs.gnu.org, "Ludovic Courtès" <ludo@gnu.org>,
"John Cowan" <cowan@ccil.org>,
guile-devel@gnu.org
Subject: Re: Segfault while building on 64-bit Cygwin
Date: Fri, 14 Feb 2020 09:46:04 -0800 [thread overview]
Message-ID: <CAPydmiN7eFD5r-v44hwdFM=1J24okQO8XjHqJ3bXQ2N1OkRVhA@mail.gmail.com> (raw)
In-Reply-To: <CAPydmiP42upuz1S=aP+hZk+tD5EJm00b4Gox1+LzEoJXVmRO=w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]
On 2/6/20, Charles Stanhope <charles@stanho.pe> wrote:
> On 2/6/20, Andy Wingo <wingo@pobox.com> 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
[-- Attachment #2: x86-fastcall-stack-reservation.patch --]
[-- Type: text/x-patch, Size: 642 bytes --]
diff --git a/lightening/x86.c b/lightening/x86.c
index 965191a..91b3a94 100644
--- a/lightening/x86.c
+++ b/lightening/x86.c
@@ -338,11 +338,13 @@ next_abi_arg(struct abi_arg_iterator *iter, jit_operand_t *arg)
if (is_gpr_arg(abi) && iter->gpr_idx < abi_gpr_arg_count) {
*arg = jit_operand_gpr (abi, abi_gpr_args[iter->gpr_idx++]);
#ifdef __CYGWIN__
+ iter->stack_size += 8;
iter->fpr_idx++;
#endif
} else if (is_fpr_arg(abi) && iter->fpr_idx < abi_fpr_arg_count) {
*arg = jit_operand_fpr (abi, abi_fpr_args[iter->fpr_idx++]);
#ifdef __CYGWIN__
+ iter->stack_size += 8;
iter->gpr_idx++;
#endif
} else {
next prev parent reply other threads:[~2020-02-14 17:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 8:39 GNU Guile 2.9.9 Released [beta] Andy Wingo
2020-01-13 8:44 ` Andy Wingo
2020-01-13 17:26 ` John Cowan
2020-01-13 23:09 ` bug#39118: " John Cowan
2020-01-20 16:35 ` bug#39118: Segfault while building on 64-bit Cygwin Ludovic Courtès
2020-01-20 16:38 ` John Cowan
2020-01-20 17:22 ` bug#39118: " Mike Gran via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2020-02-06 10:53 ` Andy Wingo
2020-02-07 4:56 ` Charles Stanhope
2020-02-14 17:46 ` Charles Stanhope [this message]
2020-02-15 17:58 ` Marco Atzeri
2020-02-16 23:23 ` Mike Gran
2020-02-16 23:24 ` John Cowan
2020-02-17 1:08 ` Charles Stanhope
2020-02-17 19:27 ` Charles Stanhope
2020-02-17 21:05 ` Andy Wingo
2020-01-21 9:01 ` Ludovic Courtès
2020-01-21 18:40 ` bug#39118: " szgyg
2020-01-21 21:53 ` John Cowan
2020-01-21 21:37 ` John Cowan
2020-01-23 20:35 ` Ludovic Courtès
2020-01-24 14:36 ` John Cowan
2020-01-25 13:51 ` Ludovic Courtès
2020-01-25 15:54 ` John Cowan
2020-01-31 14:23 ` bug#39118: " John Cowan
2020-02-03 22:11 ` szgyg
2020-02-05 21:11 ` John Cowan
2020-02-05 22:42 ` szgyg
2020-01-13 21:32 ` GNU Guile 2.9.9 Released [beta] Stefan Israelsson Tampe
2020-01-13 21:33 ` Stefan Israelsson Tampe
2020-01-14 9:57 ` Stefan Israelsson Tampe
2020-01-14 11:16 ` Andy Wingo
[not found] ` <CAGua6m3+mL-1mq0iot1+xvkgkC-_jnhX03uGpOxQkwk0iv12Vw@mail.gmail.com>
2020-01-14 11:43 ` Fwd: " Stefan Israelsson Tampe
2020-01-14 12:18 ` Mikael Djurfeldt
2020-01-14 13:25 ` Stefan Israelsson Tampe
2020-01-14 14:32 ` Andy Wingo
2020-01-14 14:47 ` Stefan Israelsson Tampe
2020-01-14 16:15 ` Andy Wingo
2020-01-14 16:36 ` Stefan Israelsson Tampe
2020-01-14 17:56 ` Stefan Israelsson Tampe
2020-01-14 16:03 ` Mikael Djurfeldt
[not found] ` <CAGua6m2cm2iFTf6EB4MuDR4qNDJ1kt1EjwRCBgLKS+qxncxp+w@mail.gmail.com>
2020-01-14 16:36 ` Fwd: " Stefan Israelsson Tampe
2020-01-14 16:47 ` Mikael Djurfeldt
2020-01-14 17:21 ` Taylan Kammer
2020-01-14 17:27 ` Stefan Israelsson Tampe
2020-01-14 20:54 ` Andy Wingo
2020-01-14 20:13 ` Stefan Israelsson Tampe
2020-01-14 21:17 ` Andy Wingo
2020-01-14 21:48 ` Stefan Israelsson Tampe
2020-01-15 19:58 ` Andy Wingo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPydmiN7eFD5r-v44hwdFM=1J24okQO8XjHqJ3bXQ2N1OkRVhA@mail.gmail.com' \
--to=charles@stanho.pe \
--cc=39118@debbugs.gnu.org \
--cc=cowan@ccil.org \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).