luajit2 icon indicating copy to clipboard operation
luajit2 copied to clipboard

FFI will fail when calling C function with varadic parameters on apple silicon machine

Open fastcoding opened this issue 5 years ago • 1 comments

On my macpro book with m1 processor (arm64), the FFI call to printf will output random garbage characters for all varadic args.

local ffi=require'ffi'
ffi.cdef[[
   int printf(const char *fmt,...);
]]
ffi.C.printf("hello %s\n","world")

Apple has mentioned the ABI difference here. I think that's the reason. Is it complicate to support this new ABI in LuaJIT?

fastcoding avatar Jan 04 '21 12:01 fastcoding

Looks like this issue is resolved by LuaJIT/LuaJIT#695 in the upstream.

Buristan avatar Aug 11 '21 12:08 Buristan