Pass -fno-math-builtin from the Clang driver to -cc1 for the l32 arch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187061 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 83aab8d..28bf5dd 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -3476,6 +3476,13 @@
options::OPT_fno_apple_pragma_pack, false))
CmdArgs.push_back("-fapple-pragma-pack");
+ // le32-specific flags:
+ // -fno-math-builtin: clang should not convert math builtins to intrinsics
+ // by default.
+ if (getToolChain().getArch() == llvm::Triple::le32) {
+ CmdArgs.push_back("-fno-math-builtin");
+ }
+
// Default to -fno-builtin-str{cat,cpy} on Darwin for ARM.
//
// FIXME: This is disabled until clang -cc1 supports -fno-builtin-foo. PR4941.
diff --git a/test/Driver/le32-toolchain.c b/test/Driver/le32-toolchain.c
new file mode 100644
index 0000000..bab5502
--- /dev/null
+++ b/test/Driver/le32-toolchain.c
@@ -0,0 +1,4 @@
+// RUN: %clang -### -target le32-unknown-nacl %s 2>&1 | FileCheck -check-prefix=CHECK-DEFAULT %s
+
+// CHECK-DEFAULT: "-cc1" {{.*}} "-fno-math-builtin"
+