[llvm] 579e721 - [Support] Implement getMainExecutable for Haiku

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 23:13:59 PST 2023


Author: Brad Smith
Date: 2023-11-24T02:12:39-05:00
New Revision: 579e721ce91bd47a7e519a85f99498eb45d3d693

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

LOG: [Support] Implement getMainExecutable for Haiku

This uses argv[0] on Haiku.

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 68ca58fda3b8fe0..3b668ba82ebbc8b 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -129,7 +129,7 @@ const file_t kInvalidFile = -1;
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) ||      \
     defined(__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
     defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) ||              \
-    (defined(__sun__) && defined(__svr4__))
+    (defined(__sun__) && defined(__svr4__) || defined(__HAIKU__))
 static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
   struct stat sb;
   char fullpath[PATH_MAX];
@@ -283,7 +283,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
   // Fall back to the classical detection.
   if (getprogpath(exe_path, argv0))
     return exe_path;
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__HAIKU__)
   char exe_path[PATH_MAX];
   // argv[0] only
   if (getprogpath(exe_path, argv0) != NULL)


        


More information about the llvm-commits mailing list