Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a segfault when _dyld_shared_cache_contains_path is not available
The _dyld_shared_cache_contains_path is only available in macOS 11.0 or later. As we are compiling in a new system that's newer than 11.0 but setting the deployment target to an older version, it's possible that the _dyld_shared_cache_contains_path is not available in the target platform and in that case we will segfault when calling it. It's also possible that when compiling memray in an old system _dyld_shared_cache_contains_path is not even prototyped in the headers. To handle this, we change to fetch the function via a dlopen/dlsym approach that will be generic in all macOS versions at the cost of an extra call to dlopen the first time we interpose symbols. Signed-off-by: Pablo Galindo <[email protected]>
- Loading branch information