[libc-commits] [libc] [libc] Add missing -latomic for rv32 (PR #99337)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 17 08:09:26 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Mikhail R. Gadelha (mikhailramalho)

<details>
<summary>Changes</summary>

On rv32, libatomic is needed to build libc when mpfr and gmp are enabled.

---
Full diff: https://github.com/llvm/llvm-project/pull/99337.diff


2 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCCheckMPFR.cmake (+1-1) 
- (modified) libc/test/src/CMakeLists.txt (+1-1) 


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCCheckMPFR.cmake b/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
index 45334a54431ef..a27c2dc0c030b 100644
--- a/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
+++ b/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
@@ -13,6 +13,6 @@ else()
     SOURCES
     ${LIBC_SOURCE_DIR}/utils/MPFRWrapper/check_mpfr.cpp
     LINK_LIBRARIES
-      -lmpfr -lgmp
+      -lmpfr -lgmp -latomic
   )
 endif()
diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index a5e7a2a4dee72..b9a50a47af75d 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -24,7 +24,7 @@ function(add_fp_unittest name)
       message(FATAL_ERROR "Hermetic math test cannot require MPFR.")
     endif()
     set(test_type UNIT_TEST_ONLY)
-    list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp)
+    list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp -latomic)
   endif()
   list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/99337


More information about the libc-commits mailing list