[libc-commits] [libc] [libc] Fix math tests for macos arm64. (PR #100060)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 23 03:24:21 PDT 2024


================
@@ -24,7 +24,12 @@ 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 -latomic)
+    if(LIBC_TARGET_OS_IS_DARWIN)
+      # macOS does not have libatomic.
+      list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp)
+    else()
+      list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp -latomic)
+    endif()
----------------
overmighty wrote:

```suggestion
    list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp)
    if(NOT(LIBC_TARGET_OS_IS_DARWIN))
      # macOS does not have libatomic.
      list(APPEND MATH_UNITTEST_LINK_LIBRARIES -latomic)
    endif()
```

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


More information about the libc-commits mailing list