[Clang] Disable building tools for 32-bit hosts as well
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 8 Feb 2023 03:18:09 +0000 (21:18 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 8 Feb 2023 03:18:50 +0000 (21:18 -0600)
Summary:
Offloading is not supported on 32-bit applications. We already disable
this for 32-bit cross-compiling but we also need to disable it for
32-bit native machines as well.

clang/tools/amdgpu-arch/CMakeLists.txt
clang/tools/nvptx-arch/CMakeLists.txt

index f50a5c5..f57ee21 100644 (file)
@@ -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 AND NOT  LLVM_BUILD_32_BITS)
+if(hsa-runtime64_FOUND AND NOT (LLVM_BUILD_32_BITS OR CMAKE_SIZEOF_VOID_P EQUAL 4))
   set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
   clang_target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)
 else()
index d40510f..1854d34 100644 (file)
@@ -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 AND NOT LLVM_BUILD_32_BITS)
+if(CUDAToolkit_FOUND AND NOT (LLVM_BUILD_32_BITS OR CMAKE_SIZEOF_VOID_P EQUAL 4))
   target_link_libraries(nvptx-arch PRIVATE CUDA::cuda_driver)
 else()
   target_compile_definitions(nvptx-arch PRIVATE "DYNAMIC_CUDA")