diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-14 00:34:46 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-14 00:34:46 +0000 |
commit | 2030d8f46b4226fa99e59389e3ca856a79c27e9a (patch) | |
tree | 27686506e4d22bb5c01a67dfd4a8930d6b0fd68a | |
parent | db2910427287a5c5e2e7e20d61982d8747b605ca (diff) |
Support -mabi= for clang/ARM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81734 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Driver/Options.def | 1 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def index c72bf36b7e..6827509eb1 100644 --- a/include/clang/Driver/Options.def +++ b/include/clang/Driver/Options.def @@ -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) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9a037c6a92..cca52de7ec 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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))); |