File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ Fixed crashes on macOS Monterey.
Original file line number Diff line number Diff line change @@ -168,6 +168,13 @@ static void __attribute__((constructor)) constructor() {
168168 exit (1 );
169169 }
170170
171+ #ifdef __APPLE__
172+ // On macOS Monterey dlsym() is pointing at symbols in current shared library
173+ // for some reason, so just use DYLD_INTERPOSE.
174+ underlying_real_mmap = REAL_IMPL (mmap );
175+ underlying_real_pthread_create = REAL_IMPL (pthread_create );
176+ underlying_real_fork = REAL_IMPL (fork );
177+ #else
171178 underlying_real_mmap = dlsym (RTLD_NEXT , "mmap" );
172179 if (!underlying_real_mmap ) {
173180 fprintf (stderr , "Couldn't load mmap(): %s\n" , dlerror ());
@@ -183,7 +190,7 @@ static void __attribute__((constructor)) constructor() {
183190 fprintf (stderr , "Couldn't load fork(): %s\n" , dlerror ());
184191 exit (1 );
185192 }
186-
193+ #endif
187194 // Initialize Rust static state before we start doing any calls via malloc(),
188195 // to ensure we don't get unpleasant reentrancy issues.
189196 pymemprofile_reset ("/tmp" );
You can’t perform that action at this time.
0 commit comments