[clang] a3ba9d6 - [Driver] Fixes for header / library paths on Haiku

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 18:34:49 PDT 2023


Author: Brad Smith
Date: 2023-09-08T21:34:31-04:00
New Revision: a3ba9d697b17ebb969b86b5c3b34b102fd22e583

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

LOG: [Driver] Fixes for header / library paths on Haiku

Some fixes for the header / library paths..

- Use concat macro for all paths
- Correct the C++ header paths
- Add library paths

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

Added: 
    clang/test/Driver/Inputs/haiku_x86_64_tree/boot/system/develop/headers/c++/v1/.keep
    clang/test/Driver/haiku.c
    clang/test/Driver/haiku.cpp

Modified: 
    clang/lib/Driver/ToolChains/Haiku.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp
index 201b80177d7512c..55fc0533f699fab 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -21,6 +21,8 @@ using namespace llvm::opt;
 Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
   : Generic_ELF(D, Triple, Args) {
 
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib"));
+  getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib"));
 }
 
 void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
@@ -52,49 +54,82 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
     return;
   }
 
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/non-packaged/develop/headers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/app");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/device");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/drivers");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/game");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/interface");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/kernel");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/locale");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/mail");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/media");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/midi2");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/net");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/opengl");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/storage");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/support");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/translation");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/graphics");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/input_server");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/mail_daemon");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/registrar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/screen_saver");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/add-ons/tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Deskbar");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/NetPositive");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/os/be_apps/Tracker");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/3rdparty");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/bsd");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/glibc");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/gnu");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers/posix");
-  addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/boot/system/develop/headers");
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/non-packaged/develop/headers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/app"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/device"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/drivers"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/game"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/interface"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/kernel"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/locale"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/mail"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/media"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/midi"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/midi2"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/net"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/opengl"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/storage"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/support"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/translation"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/graphics"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/input_server"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/mail_daemon"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/registrar"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/screen_saver"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/add-ons/tracker"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/be_apps/Deskbar"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/be_apps/NetPositive"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/os/be_apps/Tracker"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/3rdparty"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/bsd"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/glibc"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/gnu"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers/posix"));
+  addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot,
+                   "/boot/system/develop/headers"));
 }
 
 void Haiku::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
                                   llvm::opt::ArgStringList &CC1Args) const {
   addSystemInclude(DriverArgs, CC1Args,
-                   getDriver().SysRoot + "/system/develop/headers/c++/v1");
+                   concat(getDriver().SysRoot, "/boot/system/develop/headers/c++/v1"));
 }
 
 void Haiku::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
                                      llvm::opt::ArgStringList &CC1Args) const {
-  addLibStdCXXIncludePaths(getDriver().SysRoot + "/system/develop/headers/c++",
+  addLibStdCXXIncludePaths(concat(getDriver().SysRoot, "/boot/system/develop/headers/c++"),
                            getTriple().str(), "", DriverArgs, CC1Args);
 }

diff  --git a/clang/test/Driver/Inputs/haiku_x86_64_tree/boot/system/develop/headers/c++/v1/.keep b/clang/test/Driver/Inputs/haiku_x86_64_tree/boot/system/develop/headers/c++/v1/.keep
new file mode 100644
index 000000000000000..e69de29bb2d1d64

diff  --git a/clang/test/Driver/haiku.c b/clang/test/Driver/haiku.c
new file mode 100644
index 000000000000000..ec54534db6e8be6
--- /dev/null
+++ b/clang/test/Driver/haiku.c
@@ -0,0 +1,36 @@
+// Check the C header paths
+// RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/app"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/device"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/drivers"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/game"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/interface"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/kernel"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/locale"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/mail"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/media"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/midi2"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/net"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/opengl"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/storage"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/support"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/translation"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/graphics"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/input_server"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/mail_daemon"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/registrar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/screen_saver"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/add-ons/tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Deskbar"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/NetPositive"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os/be_apps/Tracker"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/3rdparty"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/bsd"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/glibc"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/gnu"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/posix"
+// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers"

diff  --git a/clang/test/Driver/haiku.cpp b/clang/test/Driver/haiku.cpp
new file mode 100644
index 000000000000000..5d8ba73ada311d1
--- /dev/null
+++ b/clang/test/Driver/haiku.cpp
@@ -0,0 +1,11 @@
+// Check the C++ header path (libstdc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBSTDCXX-HEADER-PATH %s
+// CHECK-LIBSTDCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++"
+
+// Check the C++ header path (when using libc++)
+// RUN: %clang++ --target=x86_64-unknown-haiku --stdlib=libc++ -### %s 2>&1 \
+// RUN:   --sysroot=%S/Inputs/haiku_x86_64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBCXX-HEADER-PATH %s
+// CHECK-LIBCXX-HEADER-PATH: "-internal-isystem" "[[SYSROOT:[^"]+]]/boot/system/develop/headers/c++/v1"


        


More information about the cfe-commits mailing list