]> granicus.if.org Git - clang/commitdiff
[ARM] Error out on apple darwin platforms if float-abi is "hard".
authorAkira Hatanaka <ahatanaka@apple.com>
Mon, 24 Aug 2015 19:50:35 +0000 (19:50 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Mon, 24 Aug 2015 19:50:35 +0000 (19:50 +0000)
Error out if the user tries to use float-abi="hard" since it isn't
supported on darwin platforms. Previously clang issued no warnings or
erros and just passed the option to the backend, which had no effect on
code generation for targets using apcs.

rdar://problem/22257950

Differential Revision: http://reviews.llvm.org/D12155

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245866 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/arm-float-abi.c [new file with mode: 0644]

index ba5dad5466f34d97109fb196b0a0a4b57382dc08..6bc57f724f790f496af2346ebb8e490d3b0f58f4 100644 (file)
@@ -582,6 +582,10 @@ StringRef tools::arm::getARMFloatABI(const Driver &D, const ArgList &Args,
         FloatABI = "soft";
       }
     }
+
+    if (Triple.isOSDarwin() && FloatABI == "hard")
+      D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args)
+                                                       << Triple.getArchName();
   }
 
   // If unspecified, choose the default based on the platform.
diff --git a/test/Driver/arm-float-abi.c b/test/Driver/arm-float-abi.c
new file mode 100644 (file)
index 0000000..5b8130b
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 2>&1 | FileCheck -check-prefix=ARMV7-HARD %s
+// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 2>&1 | FileCheck -check-prefix=ARMV7-SOFTFP %s
+
+// ARMV7-HARD: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
+// ARMV7-SOFTFP-NOT: unsupported option