[PATCH] D136281: [lld] [CMake] Link liblldCOFF against libatomic when necessary

Arfrever Frehtes Taifersar Arahesis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 01:15:28 PDT 2022


Arfrever added a comment.

In D136281#3870058 <https://reviews.llvm.org/D136281#3870058>, @mgorny wrote:

> `std::atomic` seems to be used in ELF and MachO libs as well; though maybe `libatomic` isn't needed for these types?

`lld-15.0.2:20221005-094634.log` (from https://bugs.gentoo.org/832675) says that this is the place where linking is needed:

  /usr/lib/gcc/powerpc-unknown-linux-gnu/11.3.1/../../../../powerpc-unknown-linux-gnu/bin/ld: COFF/CMakeFiles/lldCOFF.dir/DebugTypes.cpp.o: in function `void llvm::function_ref<void (unsigned int)>::callback_fn<lld::coff::TypeMerger::mergeTypesWithGHash()::{lambda(unsigned int)#3}>(int, unsigned int)':
  DebugTypes.cpp:(.text._ZN4llvm12function_refIFvjEE11callback_fnIZN3lld4coff10TypeMerger19mergeTypesWithGHashEvEUljE1_EEvij+0x250): undefined reference to `__atomic_load_8'
  /usr/lib/gcc/powerpc-unknown-linux-gnu/11.3.1/../../../../powerpc-unknown-linux-gnu/bin/ld: DebugTypes.cpp:(.text._ZN4llvm12function_refIFvjEE11callback_fnIZN3lld4coff10TypeMerger19mergeTypesWithGHashEvEUljE1_EEvij+0x284): undefined reference to `__atomic_compare_exchange_8'
  /usr/lib/gcc/powerpc-unknown-linux-gnu/11.3.1/../../../../powerpc-unknown-linux-gnu/bin/ld: DebugTypes.cpp:(.text._ZN4llvm12function_refIFvjEE11callback_fnIZN3lld4coff10TypeMerger19mergeTypesWithGHashEvEUljE1_EEvij+0x364): undefined reference to `__atomic_compare_exchange_8'
  collect2: error: ld returned 1 exit status

After fixing of `liblldCOFF`, there were no other errors during building of LLD.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136281/new/

https://reviews.llvm.org/D136281



More information about the llvm-commits mailing list