Support -mabi= for clang/ARM.

llvm-svn: 81734
This commit is contained in:
Daniel Dunbar 2009-09-14 00:34:46 +00:00
parent 8783737029
commit 4ed7898294
2 changed files with 27 additions and 0 deletions

View File

@ -510,6 +510,7 @@ OPTION("-m32", m32, Flag, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-m3dnowa", m3dnowa, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-m3dnow", m3dnow, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-m64", m64, Flag, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mabi=", mabi_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-march=", march_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mcmodel=", mcmodel_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mconstant-cfstrings", mconstant_cfstrings, Flag, clang_ignored_m_Group, INVALID, "", 0, 0, 0)

View File

@ -320,6 +320,32 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
const Driver &D = getToolChain().getHost().getDriver();
// Select the ABI to use.
//
// FIXME: Support -meabi.
const char *ABIName = 0;
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
ABIName = A->getValue(Args);
} else {
// Select the default based on the platform.
switch (getToolChain().getTriple().getOS()) {
// FIXME: Is this right for non-Darwin and non-Linux?
default:
ABIName = "aapcs";
break;
case llvm::Triple::Darwin:
ABIName = "apcs-gnu";
break;
case llvm::Triple::Linux:
ABIName = "aapcs-linux";
break;
}
}
CmdArgs.push_back("-target-abi");
CmdArgs.push_back(ABIName);
// Set the CPU based on -march= and -mcpu=.
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + getARMTargetCPU(Args)));