[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

llvm-svn: 340424
This commit is contained in:
Pirama Arumuga Nainar 2018-08-22 17:43:05 +00:00
parent f77dc2a8d1
commit 569dd503db
3 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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