summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-10-22 18:30:51 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-10-22 18:30:51 +0000
commit5f18f6e4d684d57b8f2430e5199e60a31ef78db0 (patch)
treecc2426c2189daa1595bf00389528533f9754352e /clang/lib/Driver/Tools.cpp
parent1c7fc71e698336e63fbf72485b900fd22060e0b9 (diff)
downloadbcm5719-llvm-5f18f6e4d684d57b8f2430e5199e60a31ef78db0.tar.gz
bcm5719-llvm-5f18f6e4d684d57b8f2430e5199e60a31ef78db0.zip
driver/Darwin: Default to AAPCS for M-class CPUs.
- This is an assumption that is currently hardwired into the backend, we need to do this in order for the frontend and backend to agree. llvm-svn: 166428
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index edaa1dbefee..7848b488d37 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -683,6 +683,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
// Get the effective triple, which takes into account the deployment target.
std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
llvm::Triple Triple(TripleStr);
+ std::string CPUName = getARMTargetCPU(Args, Triple);
// Select the ABI to use.
//
@@ -690,6 +691,14 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
const char *ABIName = 0;
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
ABIName = A->getValue(Args);
+ } else if (Triple.isOSDarwin()) {
+ // The backend is hardwired to assume AAPCS for M-class processors, ensure
+ // the frontend matches that.
+ if (StringRef(CPUName).startswith("cortex-m")) {
+ ABIName = "aapcs";
+ } else {
+ ABIName = "apcs-gnu";
+ }
} else {
// Select the default based on the platform.
switch(Triple.getEnvironment()) {
@@ -710,7 +719,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
// Set the CPU based on -march= and -mcpu=.
CmdArgs.push_back("-target-cpu");
- CmdArgs.push_back(Args.MakeArgString(getARMTargetCPU(Args, Triple)));
+ CmdArgs.push_back(Args.MakeArgString(CPUName));
// Determine floating point ABI from the options & target defaults.
StringRef FloatABI = getARMFloatABI(D, Args, Triple);
OpenPOWER on IntegriCloud