Set LLVM_ATOMIC_LIB variable for convenient linking against libatomic
authorSam James <sam@gentoo.org>
Wed, 19 Oct 2022 18:50:20 +0000 (19:50 +0100)
committerMichał Górny <mgorny@gentoo.org>
Thu, 3 Nov 2022 20:07:43 +0000 (21:07 +0100)
commitfa981b541365190ae646d2dce575706cd0626cf7
tree9750b89a478f1753a301edf6001c71547290629f
parentf62d8a1a5044df7b8d72033d056375b4ab256012
Set LLVM_ATOMIC_LIB variable for convenient linking against libatomic

* Set LLVM_ATOMIC_LIB to keep track of when we need to link against libatomic.
* Add detection of mold linker which is required for this.
* Use --as-needed when linking against libatomic as a bonus. On some platforms,
  libatomic may be required only sometimes.

Bug: https://bugs.gentoo.org/832675
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tested-by: erhard_f@mailbox.org <erhard_f@mailbox.org>
Differential Revision: https://reviews.llvm.org/D136280
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/CheckAtomic.cmake
llvm/lib/Support/CMakeLists.txt
llvm/tools/dsymutil/CMakeLists.txt