Skip to content

Commit f619796

Browse files
authored
Fix MacOS invokeNative float ret type pass error (#940)
1 parent 78308e7 commit f619796

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/iwasm/common/wasm_runtime_common.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,8 +3227,19 @@ typedef uint32x4_t __m128i;
32273227
#endif /* end of WASM_ENABLE_SIMD != 0 */
32283228

32293229
typedef void (*GenericFunctionPointer)();
3230+
#if defined(__APPLE__) || defined(__MACH__)
3231+
/**
3232+
* Define the return type as 'void' in MacOS, since after converting
3233+
* 'int64 invokeNative' into 'float64 invokeNative_Float64', the
3234+
* return value passing might be invalid, the caller reads the return
3235+
* value from register rax but not xmm0.
3236+
*/
3237+
void
3238+
invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
3239+
#else
32303240
int64
32313241
invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
3242+
#endif
32323243

32333244
typedef float64 (*Float64FuncPtr)(GenericFunctionPointer, uint64 *, uint64);
32343245
typedef float32 (*Float32FuncPtr)(GenericFunctionPointer, uint64 *, uint64);

0 commit comments

Comments
 (0)