- 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>