Add better support for ARM EABI triples.
Patch by Renato Golin!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124878 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 2cbf43e..f0a142f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -428,13 +428,16 @@
ABIName = A->getValue(Args);
} else {
// Select the default based on the platform.
- llvm::StringRef env = Triple.getEnvironmentName();
- if (env == "gnueabi")
+ switch(Triple.getEnvironment()) {
+ case llvm::Triple::GNUEABI:
ABIName = "aapcs-linux";
- else if (env == "eabi")
+ break;
+ case llvm::Triple::EABI:
ABIName = "aapcs";
- else
+ break;
+ default:
ABIName = "apcs-gnu";
+ }
}
CmdArgs.push_back("-target-abi");
CmdArgs.push_back(ABIName);
@@ -481,8 +484,7 @@
}
case llvm::Triple::Linux: {
- llvm::StringRef Env = getToolChain().getTriple().getEnvironmentName();
- if (Env == "gnueabi") {
+ if (getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUEABI) {
FloatABI = "softfp";
break;
}
@@ -490,10 +492,20 @@
// fall through
default:
- // Assume "soft", but warn the user we are guessing.
- FloatABI = "soft";
- D.Diag(clang::diag::warn_drv_assuming_mfloat_abi_is) << "soft";
- break;
+ switch(Triple.getEnvironment()) {
+ case llvm::Triple::GNUEABI:
+ FloatABI = "softfp";
+ break;
+ case llvm::Triple::EABI:
+ // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
+ FloatABI = "softfp";
+ break;
+ default:
+ // Assume "soft", but warn the user we are guessing.
+ FloatABI = "soft";
+ D.Diag(clang::diag::warn_drv_assuming_mfloat_abi_is) << "soft";
+ break;
+ }
}
}