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.
Details
Details
- Reviewers
jsji daltenty jyknight - Group Reviewers
Restricted Project - Commits
- rG96351680833e: [AIX][cmake] Set atomics related macros when build with xlclang
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Can we set LLVM_COMPILER_IS_GCC_COMPATIBLE in ./llvm/cmake/modules/DetermineGCCCompatible.cmake instead?
Comment Actions
xlclang is in theory compatible with gcc's command line syntax as clang, but there are some unexpected behaviors exposed if enable it in current LLVM cmake system. For example, when LLVM_ENABLE_WERROR is set which is our default configuration, current cmake config only add -Werror when LLVM_COMPILER_IS_GCC_COMPATIBLE
# Warnings-as-errors handling for GCC-compatible compilers: if ( LLVM_COMPILER_IS_GCC_COMPATIBLE ) append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS) endif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
If -Werror is added to xlclang's compile flags, some files are unable to compile due to treating warning as error
/home/lkail/llvm/dev/llvm-project/llvm/lib/Support/BuryPointer.cpp:22:3: error: 1540-2990 The attribute " __attribute__((used))" is not supported. The attribute is ignored. LLVM_ATTRIBUTE_USED static const void *GraveYard[kGraveYardMaxSize];
Comment Actions
LGTM. Let us deal with the LLVM_COMPILER_IS_GCC_COMPATIBLE in a follow up patch later.