diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-08-10 17:39:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-08-10 17:39:05 +0000 |
commit | 9d5600a8349cdda4e4971ebbbf7aa15a9da8bba7 (patch) | |
tree | 777eecfe897ecfbd76df51edf6daec5554957770 /lib/Driver/HostInfo.cpp | |
parent | 648220ed00711a0fb8ea4a1ab6896a4ee63d8fc5 (diff) |
Driver/FreeBSD: Infer the right arch name in the presence of -m32,-m64, for the
cases we care about.
- This is eventually going to be unified outside the host specific code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/HostInfo.cpp')
-rw-r--r-- | lib/Driver/HostInfo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Driver/HostInfo.cpp b/lib/Driver/HostInfo.cpp index 62358f84a5..cf5e382e60 100644 --- a/lib/Driver/HostInfo.cpp +++ b/lib/Driver/HostInfo.cpp @@ -345,8 +345,20 @@ ToolChain *FreeBSDHostInfo::CreateToolChain(const ArgList &Args, assert(!ArchName && "Unexpected arch name on platform without driver driver support."); + // Automatically handle some instances of -m32/-m64 we know about. std::string Arch = getArchName(); ArchName = Arch.c_str(); + if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) { + if (Triple.getArch() == llvm::Triple::x86 || + Triple.getArch() == llvm::Triple::x86_64) { + ArchName = + (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64"; + } else if (Triple.getArch() == llvm::Triple::ppc || + Triple.getArch() == llvm::Triple::ppc64) { + ArchName = + (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64"; + } + } ToolChain *&TC = ToolChains[ArchName]; if (!TC) { |