[llvm] f426712 - [Support] Use /proc/self/exe for GNU Hurd

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 10:33:36 PDT 2019


Author: kristina
Date: 2019-11-01T17:27:27Z
New Revision: f42671239ffd414c3056be9a04d8678860800148

URL: https://github.com/llvm/llvm-project/commit/f42671239ffd414c3056be9a04d8678860800148
DIFF: https://github.com/llvm/llvm-project/commit/f42671239ffd414c3056be9a04d8678860800148.diff

LOG: [Support] Use /proc/self/exe for GNU Hurd

Use `/proc/self/exe` to get the current executable
path on GNU Hurd.

Patch by sthibaul (Samuel Thibault)

Differential Revision: https://reviews.llvm.org/D69683

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Path.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index a617eca3566a..b86766d4bc43 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -203,7 +203,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
   // If we don't have procfs mounted, fall back to argv[0]
   if (getprogpath(exe_path, argv0) != NULL)
     return exe_path;
-#elif defined(__linux__) || defined(__CYGWIN__)
+#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
   char exe_path[MAXPATHLEN];
   const char *aPath = "/proc/self/exe";
   if (sys::fs::exists(aPath)) {


        


More information about the llvm-commits mailing list