Fix driver for thumb-capable ARM hosts, from Mikko Lehtonen!

llvm-svn: 127128
This commit is contained in:
Douglas Gregor 2011-03-06 19:11:49 +00:00
parent c81a7a2591
commit d9bb152821
2 changed files with 11 additions and 6 deletions

View File

@ -114,7 +114,8 @@ llvm::StringRef Darwin::getDarwinArchName(const ArgList &Args) const {
switch (getTriple().getArch()) { switch (getTriple().getArch()) {
default: default:
return getArchName(); return getArchName();
case llvm::Triple::thumb:
case llvm::Triple::arm: { case llvm::Triple::arm: {
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
if (const char *Arch = GetArmArchForMArch(A->getValue(Args))) if (const char *Arch = GetArmArchForMArch(A->getValue(Args)))
@ -1401,7 +1402,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
Lib64 = "lib64"; Lib64 = "lib64";
std::string GccTriple = ""; std::string GccTriple = "";
if (Arch == llvm::Triple::arm) { if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
if (!llvm::sys::fs::exists("/usr/lib/gcc/arm-linux-gnueabi", Exists) && if (!llvm::sys::fs::exists("/usr/lib/gcc/arm-linux-gnueabi", Exists) &&
Exists) Exists)
GccTriple = "arm-linux-gnueabi"; GccTriple = "arm-linux-gnueabi";
@ -1486,7 +1487,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
ExtraOpts.push_back("relro"); ExtraOpts.push_back("relro");
} }
if (Arch == llvm::Triple::arm) if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
ExtraOpts.push_back("-X"); ExtraOpts.push_back("-X");
if (IsFedora(Distro) || Distro == UbuntuMaverick) if (IsFedora(Distro) || Distro == UbuntuMaverick)

View File

@ -3599,13 +3599,15 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-m"); CmdArgs.push_back("-m");
if (ToolChain.getArch() == llvm::Triple::x86) if (ToolChain.getArch() == llvm::Triple::x86)
CmdArgs.push_back("elf_i386"); CmdArgs.push_back("elf_i386");
else if (ToolChain.getArch() == llvm::Triple::arm) else if (ToolChain.getArch() == llvm::Triple::arm
|| ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back("armelf_linux_eabi"); CmdArgs.push_back("armelf_linux_eabi");
else else
CmdArgs.push_back("elf_x86_64"); CmdArgs.push_back("elf_x86_64");
if (Args.hasArg(options::OPT_static)) { if (Args.hasArg(options::OPT_static)) {
if (ToolChain.getArch() == llvm::Triple::arm) if (ToolChain.getArch() == llvm::Triple::arm
|| ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back("-Bstatic"); CmdArgs.push_back("-Bstatic");
else else
CmdArgs.push_back("-static"); CmdArgs.push_back("-static");
@ -3614,12 +3616,14 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
} }
if (ToolChain.getArch() == llvm::Triple::arm || if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb ||
(!Args.hasArg(options::OPT_static) && (!Args.hasArg(options::OPT_static) &&
!Args.hasArg(options::OPT_shared))) { !Args.hasArg(options::OPT_shared))) {
CmdArgs.push_back("-dynamic-linker"); CmdArgs.push_back("-dynamic-linker");
if (ToolChain.getArch() == llvm::Triple::x86) if (ToolChain.getArch() == llvm::Triple::x86)
CmdArgs.push_back("/lib/ld-linux.so.2"); CmdArgs.push_back("/lib/ld-linux.so.2");
else if (ToolChain.getArch() == llvm::Triple::arm) else if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back("/lib/ld-linux.so.3"); CmdArgs.push_back("/lib/ld-linux.so.3");
else else
CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2"); CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");