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)
+OPTION("-mcpu=", mcpu_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mdynamic-no-pic", mdynamic_no_pic, Joined, m_Group, INVALID, "q", 0, 0, 0)
OPTION("-mfix-and-continue", mfix_and_continue, Flag, clang_ignored_m_Group, INVALID, "", 0, 0, 0)
OPTION("-miphoneos-version-min=", miphoneos_version_min_EQ, Joined, m_Group, INVALID, "", 0, 0, 0)
return isMacosxVersionLT(A, B);
}
+// FIXME: Can we tablegen this?
+static const char *GetArmArchForMArch(llvm::StringRef Value) {
+ if (Value == "armv6k")
+ return "armv6";
+
+ if (Value == "armv5tej")
+ return "armv5";
+
+ if (Value == "xscale")
+ return "xscale";
+
+ if (Value == "armv4t")
+ return "armv4t";
+
+ if (Value == "armv7" || Value == "armv7-a" || Value == "armv7-r" ||
+ Value == "armv7-m" || Value == "armv7a" || Value == "armv7r" ||
+ Value == "armv7m")
+ return "armv7";
+
+ return 0;
+}
+
+// FIXME: Can we tablegen this?
+static const char *GetArmArchForMCpu(llvm::StringRef Value) {
+ if (Value == "arm10tdmi" || Value == "arm1020t" || Value == "arm9e" ||
+ Value == "arm946e-s" || Value == "arm966e-s" ||
+ Value == "arm968e-s" || Value == "arm10e" ||
+ Value == "arm1020e" || Value == "arm1022e" || Value == "arm926ej-s" ||
+ Value == "arm1026ej-s")
+ return "armv5";
+
+ if (Value == "xscale")
+ return "xscale";
+
+ if (Value == "arm1136j-s" || Value == "arm1136jf-s" ||
+ Value == "arm1176jz-s" || Value == "arm1176jzf-s")
+ return "armv6";
+
+ if (Value == "cortex-a8" || Value == "cortex-r4" || Value == "cortex-m3")
+ return "armv7";
+
+ return 0;
+}
+
void darwin::Link::AddDarwinArch(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Derived from darwin_arch spec.
CmdArgs.push_back("-arch");
- CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName().c_str()));
+
+ switch (getToolChain().getTriple().getArch()) {
+ default:
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName().c_str()));
+ break;
+
+ case llvm::Triple::arm: {
+ // FIXME: gcc isn't actually following this, it looks like the arch is
+ // getting forced somewhere else (translation?).
+
+ if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
+ if (const char *Arch = GetArmArchForMArch(A->getValue(Args))) {
+ CmdArgs.push_back(Arch);
+ return;
+ }
+ }
+
+ if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+ if (const char *Arch = GetArmArchForMCpu(A->getValue(Args))) {
+ CmdArgs.push_back(Arch);
+ return;
+ }
+ }
+
+ CmdArgs.push_back("arm");
+ CmdArgs.push_back("-force_cpusubtype_ALL");
+ return;
+ }
+ }
}
void darwin::Link::AddDarwinSubArch(const ArgList &Args,