Possible issue on windows build (mingw)
clampi at yahoo.com
Thu Apr 5 22:34:00 CEST 2012
Yes, it works. Writing mails in the night does not really help me be grammatically and logically correct.
Regarding the bug report itself, something must also be given if you receive something for free. It is the way things are.
Being a developer myself I try to give the amount and quality of information that is needed for the bug to be fixed, not to waste a message and someone else time.
Thanks for sharing your work with the rest of us.
From: Torbjorn Granlund <tg at gmplib.org>
To: Vlad Gabriel <clampi at yahoo.com>
Cc: "gmp-bugs at gmplib.org" <gmp-bugs at gmplib.org>
Sent: Thursday, April 5, 2012 10:53 PM
Subject: Re: Possible issue on windows build (mingw)
Vlad Gabriel <clampi at yahoo.com> writes:
I can confirm that replacing
sub $8, %rsp
add $8, %rsp
sub $40, %rsp
add $40, %rsp
(I assume a "works" can be assumed here, judging from the continuation of
However, I can not understand why. Dwelving into Win64 ABI is not the
most friendly stuff. One opinion, is that the caller always has to
reserve space on stack to callee to home-registers. That is required by
the calling convention. The space is used by the callee to store the 1st
four parameters onto stack. It does not matter that the callee has 0 or
less than 4 parameters, caller must allocate space on stack for callee
to "home" the param registers. However, the callee are your own asm
functions, that do not store the parameters on stack, so I am confused
as why it works like that.
This was indeed the reason for why I suggested the change.
I did read the M$ docs, except for the unwind stuff. I was baffled
about the poor quality of such absolutely critical documentation; they
do not pin down things but leave many things open to several reasonable
The ABI specifies how to write a frame function so it can be unwinded
(by the OS). This impose great restriction on prologue, epilogue and
stack manipulation. It also make heavy use of assembler directives that
magically generates the required info to unwind the function. Good thing
is that latest GNU binutils do support the directives, bad news is that
they are not documented in their help. However,
Alas, I think I will not undertake this task.
(I can right away admit that error handling and error recovery is
perhaps GMP's weakest point. Adding some zany unwind descriptors for
windoze is not the top item on the list of things to improve in this
Thanks for your bug report and your follow-through until things were
fixed. GMP support would be a breeze if everyone did it like that!
More information about the gmp-bugs