r340424 - [Android] Default to -fno-math-errno
Pirama Arumuga Nainar via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 22 10:43:05 PDT 2018
Author: pirama
Date: Wed Aug 22 10:43:05 2018
New Revision: 340424
URL: http://llvm.org/viewvc/llvm-project?rev=340424&view=rev
Log:
[Android] Default to -fno-math-errno
Summary: Android's libm does not set errno.
Reviewers: srhines, enh
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51068
Modified:
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.h
cfe/trunk/test/Driver/fast-math.c
Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=340424&r1=340423&r2=340424&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Wed Aug 22 10:43:05 2018
@@ -907,6 +907,12 @@ bool Linux::isPIEDefault() const {
getTriple().isMusl() || getSanitizerArgs().requiresPIE();
}
+bool Linux::IsMathErrnoDefault() const {
+ if (getTriple().isAndroid())
+ return false;
+ return Generic_ELF::IsMathErrnoDefault();
+}
+
SanitizerMask Linux::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
Modified: cfe/trunk/lib/Driver/ToolChains/Linux.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.h?rev=340424&r1=340423&r2=340424&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Linux.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.h Wed Aug 22 10:43:05 2018
@@ -38,6 +38,7 @@ public:
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
bool isPIEDefault() const override;
+ bool IsMathErrnoDefault() const override;
SanitizerMask getSupportedSanitizers() const override;
void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
Modified: cfe/trunk/test/Driver/fast-math.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=340424&r1=340423&r2=340424&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Wed Aug 22 10:43:05 2018
@@ -95,6 +95,8 @@
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
// 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
//
// Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
// preserves the target default. Also check various flag set operations between
More information about the cfe-commits
mailing list