[PATCH] D72806: [HIP] fix paths for executables not in clang bin directory
Holger Wünsche via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 00:59:26 PST 2020
DieGoldeneEnte updated this revision to Diff 238708.
DieGoldeneEnte added a comment.
This patch now only adds the executable dirs to the program path, the code to search them is now in D72903 <https://reviews.llvm.org/D72903>.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72806/new/
https://reviews.llvm.org/D72806
Files:
clang/CMakeLists.txt
clang/lib/Driver/ToolChains/HIP.cpp
Index: clang/lib/Driver/ToolChains/HIP.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -277,6 +277,16 @@
// Lookup binaries into the driver directory, this is used to
// discover the clang-offload-bundler executable.
getProgramPaths().push_back(getDriver().Dir);
+
+// add llvm binaries in case they are not in the driver directory
+#if defined(LLVM_TOOLS_BINARY_DIR)
+ getProgramPaths().push_back(LLVM_TOOLS_BINARY_DIR);
+#endif
+
+// add lld binary in case they are not in the driver directory
+#if defined(LLD_BINARY_DIR)
+ getProgramPaths().push_back(LLD_BINARY_DIR);
+#endif
}
void HIPToolChain::addClangTargetOptions(
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -866,6 +866,24 @@
llvm_distribution_add_targets()
endif()
+# add LLVM_TOOLS_BINARY_DIR to Defines to make llc, llvm-link and opt available
+# for HIP toolchain
+if(DEFINED LLVM_TOOLS_BINARY_DIR)
+ add_definitions( -DLLVM_TOOLS_BINARY_DIR="${LLVM_TOOLS_BINARY_DIR} " )
+ message(STATUS "found llvm executable dir: ${LLVM_TOOLS_BINARY_DIR}")
+endif()
+
+# add LLD_BINARY_DIR to Defines to make lld available for HIP toolchain
+find_program(LLD_BINARY NAMES lld)
+if(NOT LLD_BINARY MATCHES "-NOTFOUND" AND NOT DEFINED LLD_BINARY_DIR)
+ message(STATUS "found lld executable: ${LLD_BINARY}")
+ get_filename_component(LLD_BINARY_DIR ${LLD_BINARY} DIRECTORY)
+endif()
+if(DEFINED LLD_BINARY)
+ add_definitions( -DLLD_BINARY_DIR="${LLD_BINARY_DIR} " )
+endif()
+
+
configure_file(
${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
${CLANG_BINARY_DIR}/include/clang/Config/config.h)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72806.238708.patch
Type: text/x-patch
Size: 1793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200117/eb2ea6f2/attachment.bin>
More information about the cfe-commits
mailing list