Hi echristo,
LLVM does not and has not ever supported a soft-float ABI mode on
Sparc, so don't pretend that it does.
Also switch the default from "soft-float" -- which was actually
hard-float because soft-float is unimplemented -- to hard-float.
http://reviews.llvm.org/D10457
Files:
lib/Driver/Tools.cpp
test/Driver/sparc-float.c
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1320,47 +1320,31 @@
return "";
}
+// Only the hard-float ABI on Sparc is standardized, and it is the
+// default. GCC also supports a nonstandard soft-float ABI mode, and
+// perhaps LLVM should implement that, too. However, since llvm
+// currently does not support Sparc soft-float, at all, display an
+// error if it's requested.
+
static void getSparcTargetFeatures(const ArgList &Args,
std::vector<const char *> &Features) {
- bool SoftFloatABI = true;
- if (Arg *A =
- Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) {
- if (A->getOption().matches(options::OPT_mhard_float))
- SoftFloatABI = false;
- }
- if (SoftFloatABI)
- Features.push_back("+soft-float");
}
void Clang::AddSparcTargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
const Driver &D = getToolChain().getDriver();
+ std::string Triple = getToolChain().ComputeEffectiveClangTriple(Args);
- // Select the float ABI as determined by -msoft-float and -mhard-float.
- StringRef FloatABI;
- if (Arg *A = Args.getLastArg(options::OPT_msoft_float,
- options::OPT_mhard_float)) {
+ bool SoftFloatABI = false;
+ if (Arg *A =
+ Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) {
if (A->getOption().matches(options::OPT_msoft_float))
- FloatABI = "soft";
- else if (A->getOption().matches(options::OPT_mhard_float))
- FloatABI = "hard";
+ SoftFloatABI = true;
}
- // If unspecified, choose the default based on the platform.
- if (FloatABI.empty()) {
- // Assume "soft", but warn the user we are guessing.
- FloatABI = "soft";
- D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
- }
-
- if (FloatABI == "soft") {
- // Floating point operations and argument passing are soft.
- //
- // FIXME: This changes CPP defines, we need -target-soft-float.
- CmdArgs.push_back("-msoft-float");
- } else {
- assert(FloatABI == "hard" && "Invalid float abi!");
- CmdArgs.push_back("-mhard-float");
+ if (SoftFloatABI) {
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << "-msoft-float" << Triple;
}
}
Index: test/Driver/sparc-float.c
===================================================================
--- test/Driver/sparc-float.c
+++ test/Driver/sparc-float.c
@@ -5,38 +5,36 @@
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s
-// CHECK-DEF: "-target-feature" "+soft-float"
-// CHECK-DEF: "-msoft-float"
+// CHECK-DEF-NOT: "-target-feature" "+soft-float"
+// CHECK-DEF-NOT: "-msoft-float"
//
// -mhard-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu -mhard-float \
// RUN: | FileCheck --check-prefix=CHECK-HARD %s
-// CHECK-HARD: "-mhard-float"
+// CHECK-HARD-NOT: "-msoft-float"
//
// -msoft-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc-linux-gnu -msoft-float \
// RUN: | FileCheck --check-prefix=CHECK-SOFT %s
-// CHECK-SOFT: "-target-feature" "+soft-float"
-// CHECK-SOFT: "-msoft-float"
+// CHECK-SOFT: error: unsupported option '-msoft-float'
//
// Default sparc64
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-DEF-SPARC64 %s
-// CHECK-DEF-SPARC64: "-target-feature" "+soft-float"
-// CHECK-DEF-SPARC64: "-msoft-float"
+// CHECK-DEF-SPARC64-NOT: "-target-feature" "+soft-float"
+// CHECK-DEF-SPARC64-NOT: "-msoft-float"
//
// -mhard-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu -mhard-float \
// RUN: | FileCheck --check-prefix=CHECK-HARD-SPARC64 %s
-// CHECK-HARD-SPARC64: "-mhard-float"
+// CHECK-HARD-SPARC64-NOT: "-msoft-float"
//
// -msoft-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target sparc64-linux-gnu -msoft-float \
// RUN: | FileCheck --check-prefix=CHECK-SOFT-SPARC64 %s
-// CHECK-SOFT-SPARC64: "-target-feature" "+soft-float"
-// CHECK-SOFT-SPARC64: "-msoft-float"
+// CHECK-SOFT-SPARC64: error: unsupported option '-msoft-float'
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits