[PATCH] D68964: cmake/modules/CheckAtomic.cmake: catch false positives in RISC-V
Gokturk Yuksek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 13:19:12 PDT 2019
gokturk added a comment.
Please do not merge.
I do not see how the result of this check is propagated to LDFLAGS by the build system. Even after this patch, the build fails the same way:
/usr/lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: tools/dsymutil/CMakeFiles/dsymutil.dir/dsymutil.cpp.o: in function `.LEHB79':
dsymutil.cpp:(.text._ZNSt17_Function_handlerIFvvESt5_BindIFZ4mainEUlSt10shared_ptrIN4llvm14raw_fd_ostreamEENS3_8dsymutil11LinkOptionsEE_S5_S7_EEE9_M_invokeERKSt9_Any_data+0x168): undefined reference to `__atomic_fetch_and_1'
/usr/lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: tools/dsymutil/CMakeFiles/dsymutil.dir/dsymutil.cpp.o: in function `.L0 ':
dsymutil.cpp:(.text._ZNSt17_Function_handlerIFvvESt5_BindIFZ4mainEUlSt10shared_ptrIN4llvm14raw_fd_ostreamEENS3_8dsymutil11LinkOptionsEE_S5_S7_EEE9_M_invokeERKSt9_Any_data+0x2ee): undefined reference to `__atomic_fetch_and_1'
/usr/lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: dsymutil.cpp:(.text.startup.main+0xefc): undefined reference to `__atomic_fetch_and_1'
/usr/lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: tools/dsymutil/CMakeFiles/dsymutil.dir/dsymutil.cpp.o: in function `.L2508':
dsymutil.cpp:(.text.startup.main+0x1b2a): undefined reference to `__atomic_fetch_and_1'
collect2: error: ld returned 1 exit status
libcxx has the following in CMakeLists.txt:
if (LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
target_link_libraries(${target} PRIVATE atomic)
endif()
but LLVM's CMakeLists.txt does not contain anything like that.
I think we have potentially 3 separate bugs:
1. In LLVM, the check for libatomic has false positives in RISC-V (which the patch is addressing).
2. In LLVM, the result of the libatomic check is not being used to add '-latomic' to LDFLAGS.
3. libcxx libatomic check is likely to exhibit false positive in RISC-V.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68964/new/
https://reviews.llvm.org/D68964
More information about the llvm-commits
mailing list