Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ignore stdcall c-call in native codegen on x86_64

The stdcall calling convention is not supported on x86_64.
When an ffi import requests stdcall, a warning is issued as
desired by #3336. However, the native codegen was still
generating code that expected the callee to cleanup the
stack arguments when calling a c function that requests
stdcall.

This patch changes the codegen to actually use the ccall
calling convention as intended.
  • Loading branch information...
commit 42b052d9c1dc17d74bd6a5c52f8edc226f270531 1 parent e3b3248
David Peixotto authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 compiler/nativeGen/X86/CodeGen.hs
5 compiler/nativeGen/X86/CodeGen.hs
View
@@ -1887,8 +1887,9 @@ genCCall64 target dest_regs args =
let call = callinsns `appOL`
toOL (
-- Deallocate parameters after call for ccall;
- -- but not for stdcall (callee does it)
- (if cconv == StdCallConv || real_size==0 then [] else
+ -- stdcall has callee do it, but is not supported on
+ -- x86_64 target (see #3336)
+ (if real_size==0 then [] else
[ADD (intSize wordWidth) (OpImm (ImmInt real_size)) (OpReg esp)])
++
[DELTA (delta + real_size)]
Please sign in to comment.
Something went wrong with that request. Please try again.