2

Are FPC's nostackframe and Delphi's .NOFRAME directive exactly equivalent in 64-bit asm functions?

In other words does the next code template

procedure Naked(SomeArg: Integer);{$IFDEF FPC}nostackframe;{$ENDIF}
asm
{$IFNDEF FPC}
        .NOFRAME
{$ENDIF}
  ..
end;

generates identical naked 64-bit asm functions in Delphi and FPC?

PhiS
  • 4,540
  • 25
  • 35
kludg
  • 27,213
  • 5
  • 67
  • 118
  • 1
    See [Assembly calls to System unit functions on FreePascal x64](http://stackoverflow.com/q/16559833/576719) for an answer. – LU RD Oct 21 '14 at 17:27
  • 1
    Frameless and naked are two different things, last time I've checked. Naked means no prologue/epilogue. Naked implies frameless but not the other way around. – Seva Alekseyev Oct 21 '14 at 18:01
  • .NOFRAME generates a naked (and thus frameless) procedure. If there is no frame, the prolog/epilog are not required and not generated (at least in Delphi). – Rudy Velthuis Jul 02 '16 at 19:21

1 Answers1

2

As far as I've been able to determine, both .NOFRAME (Delphi) and nostackframe (FPC) do the same thing, i.e. prevent the generation of a stack frame. Note however that the conditions under which they take effect might not be identical in the two compilers.

For source code compatibility, also use {$ASMMODE INTEL} for FPC.

For the most part, FPC64 and DCC64 asm use the same syntax, but in some rare cases, there are some differences in what syntax the inline assemblers understand. Also be aware that non-Windows x64 platforms use different calling conventions.

PhiS
  • 4,540
  • 25
  • 35