[PATCH] D69003: cmake/modules/AddLLVM.cmake: pass '-latomic' to the linker if necessary

Gokturk Yuksek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 13:46:40 PDT 2019


gokturk created this revision.
gokturk added reviewers: davezarzycki, hhb, beanz, jfb.
Herald added subscribers: llvm-commits, dexonsmith, mgorny.
Herald added a project: LLVM.
gokturk added a comment.

I've started a build on the affected VM (riscv64gc) to see if it solved the problem. It typically takes ~20 hours until the error is produced.

Also see https://reviews.llvm.org/D68964, related to this issue.


The result of the CheckAtomic module is currently not being used. So,
even if it detects that passing '-latomic' is necessary, it is not
propagated along the build system. Fix it by checking the flags
HAVE_CXX_ATOMICS_WITH_LIB or HAVE_CXX_ATOMICS64_WITH_LIB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69003

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -815,6 +815,10 @@
     target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB})
   endif()
 
+  if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
+    target_link_libraries(${name} PRIVATE atomic)
+  endif()
+
   llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})
 endmacro(add_llvm_executable name)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69003.225106.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/42044c7a/attachment.bin>


More information about the llvm-commits mailing list