From 23d82b96205eef3ceb3c38f88c80ee21cdfaa720 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 11 May 2013 21:23:42 +0200 Subject: [PATCH] Only specify -m32/-m64 for archs where the variants exist. --- driver/linker.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/driver/linker.cpp b/driver/linker.cpp index 052aa9ae..4b20a437 100644 --- a/driver/linker.cpp +++ b/driver/linker.cpp @@ -185,12 +185,16 @@ static int linkObjToBinaryGcc(bool sharedLib) break; } - //FIXME: enforce 64 bit - if (global.params.is64bit) - args.push_back("-m64"); - else - // Assume 32-bit? - args.push_back("-m32"); + // Only specify -m32/-m64 for architectures where the two variants actually + // exist (as e.g. the GCC ARM toolchain doesn't recognize the switches). + if (global.params.targetTriple.get64BitArchVariant().getArch() != + llvm::Triple::UnknownArch + ) { + if (global.params.is64bit) + args.push_back("-m64"); + else + args.push_back("-m32"); + } if (opts::createSharedLib && addSoname) { std::string soname = opts::soname;