[libc-commits] [libc] 65a4ce0 - [libc] Can build amdgpu libc even if rocm is missing

Jon Chesterfield via libc-commits libc-commits at lists.llvm.org
Thu Jun 22 13:18:58 PDT 2023


Author: Jon Chesterfield
Date: 2023-06-22T21:18:44+01:00
New Revision: 65a4ce09f8a58b7bcc7a3f0cf66bd5c96b629366

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

LOG: [libc] Can build amdgpu libc even if rocm is missing

Clang defaults to failing to build if it can't find rocm device libs

Reviewed By: jhuber6

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

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 803d5854dae05..8ce195291b671 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -520,12 +520,12 @@ function(add_integration_test test_name)
   # The GPU build requires overriding the default CMake triple and architecture.
   if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
     target_compile_options(${fq_build_target_name} PRIVATE
-                           -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
+                           -nogpulib -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
                            -flto --target=${LIBC_GPU_TARGET_TRIPLE})
   elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
     get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE})
     target_compile_options(${fq_build_target_name} PRIVATE
-                           ${nvptx_options} -fno-use-cxa-atexit
+                           -nogpulib ${nvptx_options} -fno-use-cxa-atexit
                            --target=${LIBC_GPU_TARGET_TRIPLE})
   endif()
 
@@ -571,11 +571,11 @@ set(LIBC_HERMETIC_TEST_COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_DEFAULT}
 # The GPU build requires overriding the default CMake triple and architecture.
 if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
   list(APPEND LIBC_HERMETIC_TEST_COMPILE_OPTIONS
-       -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto --target=${LIBC_GPU_TARGET_TRIPLE})
+       -nogpulib -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto --target=${LIBC_GPU_TARGET_TRIPLE})
 elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
   get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE})
   list(APPEND LIBC_HERMETIC_TEST_COMPILE_OPTIONS
-       ${nvptx_options} -fno-use-cxa-atexit --target=${LIBC_GPU_TARGET_TRIPLE})
+       -nogpulib ${nvptx_options} -fno-use-cxa-atexit --target=${LIBC_GPU_TARGET_TRIPLE})
 endif()
 
 # Rule to add a hermetic test. A hermetic test is one whose executable is fully


        


More information about the libc-commits mailing list