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 12
12
#include " swift/extractor/infra/file/FileHash.h"
13
13
14
14
#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"
16
17
#define FILE_CREATION_MODE O_CREAT
17
18
#else
18
19
#define SHARED_LIBC " libc.so.6"
@@ -24,8 +25,16 @@ namespace fs = std::filesystem;
24
25
namespace {
25
26
namespace original {
26
27
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
+
27
36
void * libc () {
28
- static auto ret = dlopen (SHARED_LIBC, RTLD_LAZY );
37
+ static auto ret = openLibC ( );
29
38
return ret;
30
39
}
31
40
You can’t perform that action at this time.
0 commit comments