File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1212#include " swift/extractor/infra/file/FileHash.h"
1313
1414#ifdef __APPLE__
15- #define SHARED_LIBC " libc.dylib"
15+ // path is hardcoded as otherwise redirection could break when setting DYLD_FALLBACK_LIBRARY_PATH
16+ #define SHARED_LIBC " /usr/lib/libc.dylib"
1617#define FILE_CREATION_MODE O_CREAT
1718#else
1819#define SHARED_LIBC " libc.so.6"
@@ -24,8 +25,16 @@ namespace fs = std::filesystem;
2425namespace {
2526namespace original {
2627
28+ void * openLibC () {
29+ if (auto ret = dlopen (SHARED_LIBC, RTLD_LAZY)) {
30+ return ret;
31+ }
32+ std::cerr << " Unable to dlopen " SHARED_LIBC " !\n " ;
33+ std::abort ();
34+ }
35+
2736void * libc () {
28- static auto ret = dlopen (SHARED_LIBC, RTLD_LAZY );
37+ static auto ret = openLibC ( );
2938 return ret;
3039}
3140
You can’t perform that action at this time.
0 commit comments