diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
commit | a16e30d162c1c7408db7821e7b9513cefa09c6ca (patch) | |
tree | af752ba9ba44c547df39bb0af9bff79f610ba9d5 /src/runtime/cgo/gcc_darwin_arm64.c | |
parent | 91e4d2d57bc341dd82c98247117114c851380aef (diff) | |
parent | cf6cfba4d5358404dd890f6025e573a4b2156543 (diff) | |
download | go-git-dev.link.tar.gz |
[dev.link] all: merge branch 'master' into dev.linkdev.link
Clean merge.
Change-Id: Ia7b2808bc649790198d34c226a61d9e569084dc5
Diffstat (limited to 'src/runtime/cgo/gcc_darwin_arm64.c')
-rw-r--r-- | src/runtime/cgo/gcc_darwin_arm64.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/runtime/cgo/gcc_darwin_arm64.c b/src/runtime/cgo/gcc_darwin_arm64.c index fd7d4084c9..dbe848b4ee 100644 --- a/src/runtime/cgo/gcc_darwin_arm64.c +++ b/src/runtime/cgo/gcc_darwin_arm64.c @@ -10,12 +10,16 @@ #include <unistd.h> #include <stdlib.h> -#include <CoreFoundation/CFBundle.h> -#include <CoreFoundation/CFString.h> - #include "libcgo.h" #include "libcgo_unix.h" +#include <TargetConditionals.h> + +#if TARGET_OS_IPHONE +#include <CoreFoundation/CFBundle.h> +#include <CoreFoundation/CFString.h> +#endif + #define magic (0xc476c475c47957UL) // inittls allocates a thread-local storage slot for g. @@ -87,14 +91,18 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); +#if TARGET_OS_IPHONE darwin_arm_init_thread_exception_port(); +#endif crosscall1(ts.fn, setg_gcc, (void*)ts.g); return nil; } +#if TARGET_OS_IPHONE + // init_working_dir sets the current working directory to the app root. -// By default darwin/arm64 processes start in "/". +// By default ios/arm64 processes start in "/". static void init_working_dir() { @@ -131,7 +139,7 @@ init_working_dir() fprintf(stderr, "runtime/cgo: chdir(%s) failed\n", dir); } - // The test harness in go_darwin_arm_exec passes the relative working directory + // The test harness in go_ios_exec passes the relative working directory // in the GoExecWrapperWorkingDirectory property of the app bundle. CFStringRef wd_ref = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("GoExecWrapperWorkingDirectory")); if (wd_ref != NULL) { @@ -145,6 +153,8 @@ init_working_dir() } } +#endif // TARGET_OS_IPHONE + void x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) { @@ -161,8 +171,9 @@ x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) // yes, tlsbase from mrs might not be correctly aligned. inittls(tlsg, (void**)((uintptr)tlsbase & ~7)); +#if TARGET_OS_IPHONE darwin_arm_init_mach_exception_handler(); darwin_arm_init_thread_exception_port(); - init_working_dir(); +#endif } |