[clang] 9f64fbb - [Clang] Do not attempt to directly link arch tools in 32-bit mode
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 31 09:56:41 PST 2023
Author: Joseph Huber
Date: 2023-01-31T11:56:24-06:00
New Revision: 9f64fbb882dc3c76712ec70316253ca396baa824
URL: https://github.com/llvm/llvm-project/commit/9f64fbb882dc3c76712ec70316253ca396baa824
DIFF: https://github.com/llvm/llvm-project/commit/9f64fbb882dc3c76712ec70316253ca396baa824.diff
LOG: [Clang] Do not attempt to directly link arch tools in 32-bit mode
Summary:
We offer almost no support for offloading on 32-bit systems. This causes
some problems when cross-compiling for 32-bit machines as it will find
the CUDA from the host that is incompatible. Instead we force these to
always use the dynamically loaded version, which should always compile.
Added:
Modified:
clang/tools/amdgpu-arch/CMakeLists.txt
clang/tools/nvptx-arch/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/tools/amdgpu-arch/CMakeLists.txt b/clang/tools/amdgpu-arch/CMakeLists.txt
index d687d1691b7a6..f50a5c5365a6f 100644
--- a/clang/tools/amdgpu-arch/CMakeLists.txt
+++ b/clang/tools/amdgpu-arch/CMakeLists.txt
@@ -12,7 +12,7 @@ add_clang_tool(amdgpu-arch AMDGPUArch.cpp)
# If we find the HSA runtime we link with it directly.
find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
-if (${hsa-runtime64_FOUND})
+if (hsa-runtime64_FOUND AND NOT LLVM_BUILD_32_BITS)
set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
clang_target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)
else()
diff --git a/clang/tools/nvptx-arch/CMakeLists.txt b/clang/tools/nvptx-arch/CMakeLists.txt
index 95c25dc75847e..d40510f3da835 100644
--- a/clang/tools/nvptx-arch/CMakeLists.txt
+++ b/clang/tools/nvptx-arch/CMakeLists.txt
@@ -12,7 +12,7 @@ add_clang_tool(nvptx-arch NVPTXArch.cpp)
find_package(CUDAToolkit QUIET)
# If we found the CUDA library directly we just dynamically link against it.
-if (CUDAToolkit_FOUND)
+if (CUDAToolkit_FOUND AND NOT LLVM_BUILD_32_BITS)
target_link_libraries(nvptx-arch PRIVATE CUDA::cuda_driver)
else()
target_compile_definitions(nvptx-arch PRIVATE "DYNAMIC_CUDA")
More information about the cfe-commits
mailing list