[cfe-commits] r81734 - in /cfe/trunk: include/clang/Driver/Options.def lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Sun Sep 13 17:34:47 PDT 2009


Author: ddunbar
Date: Sun Sep 13 19:34:46 2009
New Revision: 81734

URL: http://llvm.org/viewvc/llvm-project?rev=81734&view=rev
Log:
Support -mabi= for clang/ARM.

Modified:
    cfe/trunk/include/clang/Driver/Options.def
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=81734&r1=81733&r2=81734&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Sun Sep 13 19:34:46 2009
@@ -510,6 +510,7 @@
 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)

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=81734&r1=81733&r2=81734&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Sep 13 19:34:46 2009
@@ -320,6 +320,32 @@
                              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)));
 





More information about the cfe-commits mailing list