[llvm] 9635168 - [AIX][cmake] Set atomics related macros when build with xlclang

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 02:18:10 PDT 2021


Author: Kai Luo
Date: 2021-10-18T09:18:05Z
New Revision: 96351680833e99f0b7161a93ade0a23d7e7e8ba5

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

LOG: [AIX][cmake] Set atomics related macros when build with xlclang

Set `HAVE_CXX_ATOMICS_WITHOUT_LIB` or `HAVE_LIBATOMIC` when build LLVM with xlclang. With these macros set, libraries like libLLVMSupport are able to know whether it's necessary to add `-latomic` to dependent system libs. If `HAVE_LIBATOMIC` is set, `llvm-config --system-libs` appends `-latomic` to its output.

Reviewed By: jsji

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

Added: 
    

Modified: 
    llvm/cmake/modules/CheckAtomic.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
index 04eed14484827..3c5ba72993a3a 100644
--- a/llvm/cmake/modules/CheckAtomic.cmake
+++ b/llvm/cmake/modules/CheckAtomic.cmake
@@ -43,7 +43,7 @@ endfunction(check_working_cxx_atomics64)
 # Check for (non-64-bit) atomic operations.
 if(MSVC)
   set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
-elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL")
   # First check if atomics work without the library.
   check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
   # If not, check if the library exists, and atomics work with it.
@@ -64,7 +64,7 @@ endif()
 # Check for 64 bit atomic operations.
 if(MSVC)
   set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
-elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL")
   # First check if atomics work without the library.
   check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
   # If not, check if the library exists, and atomics work with it.


        


More information about the llvm-commits mailing list