diff --git a/core/unix/os.c b/core/unix/os.c index 9d9becdb14f..b075dfa6cce 100644 --- a/core/unix/os.c +++ b/core/unix/os.c @@ -784,7 +784,7 @@ static init_fn_t #else /* If we're a normal shared object, then we override _init. */ -int +IF_MACOS(__attribute__((constructor))) int _init(int argc, char **argv, char **envp) { # ifdef ANDROID @@ -1143,6 +1143,7 @@ get_application_name_helper(bool ignore_cache, bool full_path) #else /* OSX kernel puts full app exec path above envp */ char *c, **env = our_environ; + ASSERT(our_environ != NULL && "our_environ is not set in get_application_name_helper"); do { env++; } while (*env != NULL); diff --git a/core/unix/preload.c b/core/unix/preload.c index 3bf55bb3dce..2f457490da3 100644 --- a/core/unix/preload.c +++ b/core/unix/preload.c @@ -137,7 +137,7 @@ take_over(const char *pname) return true; } -__attribute__((constructor)) int +IF_MACOS(__attribute__((constructor))) int #if INIT_BEFORE_LIBC _init(int argc, char *arg0, ...) {