-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
llvm: Avoid looking at /proc/self/exe
LLVM looks at /proc/self/exe to determine which binary has been called. This does not work with the proposed changes for termux-exec: termux/termux-exec#24 Luckily the fallback to look at argv0 works instead.
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
diff -u -r ../orig-src/llvm/lib/Support/Unix/Path.inc ./llvm/lib/Support/Unix/Path.inc | ||
--- ../orig-src/llvm/lib/Support/Unix/Path.inc 2023-09-29 21:36:47.056335287 +0000 | ||
+++ ./llvm/lib/Support/Unix/Path.inc 2023-09-29 21:40:31.091417185 +0000 | ||
@@ -252,6 +252,7 @@ | ||
return exe_path; | ||
#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) | ||
char exe_path[PATH_MAX]; | ||
+#ifndef __ANDROID__ /* Avoid looking at /proc/self/exe, as it does not work with termux-exec linker wrapping */ | ||
const char *aPath = "/proc/self/exe"; | ||
if (sys::fs::exists(aPath)) { | ||
// /proc is not always mounted under Linux (chroot for example). | ||
@@ -280,6 +281,7 @@ | ||
return std::string(real_path); | ||
#endif | ||
} | ||
+#endif | ||
// Fall back to the classical detection. | ||
if (getprogpath(exe_path, argv0)) | ||
return exe_path; |