mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
darwin: fix syscall.Open on darwin/arm64
Unfortunately the calling convention for variadic functions is different from the calling convention of regular functions on darwin/arm64, and open happens to be such a variadic function. The syscall package treated it like a regular function, which resulted in buggy behavior. This fix introduces a wrapper function. This is the cleanest change I could come up with.
This commit is contained in:
committed by
Ron Evans
parent
2072d1bb5c
commit
7e9d84777e
@@ -0,0 +1,7 @@
|
||||
// Wrapper function because 'open' is a variadic function and variadic functions
|
||||
// use a different (incompatible) calling convention on darwin/arm64.
|
||||
|
||||
#include <fcntl.h>
|
||||
int syscall_libc_open(const char *pathname, int flags, mode_t mode) {
|
||||
return open(pathname, flags, mode);
|
||||
}
|
||||
@@ -5,6 +5,8 @@ package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
import "C" // dummy import so that os_darwin.c works
|
||||
|
||||
const GOOS = "darwin"
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user