[llvm-branch-commits] [clang] 190be54 - [Driver] Default to -fno-math-errno for musl
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 4 19:21:54 PST 2022
Author: Alex Xu (Hello71)
Date: 2022-02-04T19:21:48-08:00
New Revision: 190be5457c905ca55100927d1f5846cd30cee87d
URL: https://github.com/llvm/llvm-project/commit/190be5457c905ca55100927d1f5846cd30cee87d
DIFF: https://github.com/llvm/llvm-project/commit/190be5457c905ca55100927d1f5846cd30cee87d.diff
LOG: [Driver] Default to -fno-math-errno for musl
musl does not set errno in math functions: https://wiki.musl-libc.org/mathematical-library.html, https://git.musl-libc.org/cgit/musl/tree/include/math.h?id=cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b#n26.
Reviewed By: srhines, MaskRay
Differential Revision: https://reviews.llvm.org/D116753
(cherry picked from commit 38449c98f3d33dffdaf7e1feeb9dfdcf63b5126b)
Added:
Modified:
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/fast-math.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index af74b108e04ee..f85c04df4f6c9 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -687,7 +687,7 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
}
bool Linux::IsMathErrnoDefault() const {
- if (getTriple().isAndroid())
+ if (getTriple().isAndroid() || getTriple().isMusl())
return false;
return Generic_ELF::IsMathErrnoDefault();
}
diff --git a/clang/test/Driver/fast-math.c b/clang/test/Driver/fast-math.c
index a66e9d0eca177..36ea8ecb52985 100644
--- a/clang/test/Driver/fast-math.c
+++ b/clang/test/Driver/fast-math.c
@@ -119,6 +119,8 @@
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-linux-musl -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target amdgcn-amd-amdhsa -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target amdgcn-amd-amdpal -c %s 2>&1 \
More information about the llvm-branch-commits
mailing list