[fpc-devel] Broken frac functioninFPC3.1.1 / Windows x86_64
J. Gareth Moreton
gareth at moreton-family.com
Sun Apr 29 13:54:16 CEST 2018
I stand corrected.
Normally if I want to write a second epilogue, I simply compile the
project and look at the disassembly, and copy what the compiler puts in for
the epilogue. The only one I remember off-hand is for leaf functions with
no stack frame and which uses only volatile registers, hence a simple
RET. I'll get it right in the end!
Gareth aka. Kit
P.S. You might want to tell your spam filter that these messages are
sound, so we're not put off at the sight of "*** GMX Spamverdacht ***"!
On Sun 29/04/18 12:44 , "Thorsten Engler" thorsten.engler at gmx.net sent:
> From: fpc-devel On Behalf
> Of J. Gareth Moreton
> For functions with a stack frame, either LEAVE or MOV RSP, RBP; POP
> RBP must precede it.
It's not quite that simple, at least under windows:
https://docs.microsoft.com/en-us/cpp/build/prolog-and-epilog [2]
But yes, this documents that there can be multiple epilogues, so the
additional ret would be fine in this regard.
Following this exact format is required so that the stack unwinder during
processing of SEH (structured exception handling) which is performed by the
OS can correctly restore the value of non-volatile registers that has been
saved on the stack.
Fortunately, as our function in this case doesn't use the stack at all and
doesn't contain calls to other functions, this can be skipped.
> So what happens now? Do we submit a patch?
I think Sven Barth was going to fix this up anyway?
Cheers,
Thorsten
_______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org [3]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[4]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] mailto:fpc-devel-bounces at lists.freepascal.org
[2] https://docs.microsoft.com/en-us/cpp/build/prolog-and-epilog
[3] mailto:fpc-devel at lists.freepascal.org
[4] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180429/38de51e2/attachment.html>
More information about the fpc-devel
mailing list