We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
libc.dylib
1 parent 3084eda commit 208388eCopy full SHA for 208388e
1 file changed
swift/extractor/remapping/SwiftFileInterception.cpp
@@ -12,7 +12,8 @@
12
#include "swift/extractor/infra/file/FileHash.h"
13
14
#ifdef __APPLE__
15
-#define SHARED_LIBC "libc.dylib"
+// path is hardcoded as otherwise redirection could break when setting DYLD_FALLBACK_LIBRARY_PATH
16
+#define SHARED_LIBC "/usr/lib/libc.dylib"
17
#define FILE_CREATION_MODE O_CREAT
18
#else
19
#define SHARED_LIBC "libc.so.6"
@@ -24,8 +25,16 @@ namespace fs = std::filesystem;
24
25
namespace {
26
namespace original {
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
+
36
void* libc() {
- static auto ret = dlopen(SHARED_LIBC, RTLD_LAZY);
37
+ static auto ret = openLibC();
38
return ret;
39
}
40
0 commit comments