ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

Error out if user provides -mfloat-abi=hard or -mhard-float on the command line 
since hard float abi isn't supported on apple platforms (except for non-darwin 
platforms).

http://reviews.llvm.org/D12155

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-float-abi.c

Index: test/Driver/arm-float-abi.c
===================================================================
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -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
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
         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.


Index: test/Driver/arm-float-abi.c
===================================================================
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -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
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
         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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to