driver improvements for freebsd-*-mips*

With the recent advances in the MIPS backend I've been trying to get
FreeBSD to cross build with it. The following patch makes the FreeBSD
driver act the same as the linux code in the MIPS case (by copying it)
in addition to making the rest of the function use getArch() instad of
getArchName().

-- Brooks

$FreeBSD: head/lang/clang-devel/files/patch-tools_clang_lib_Driver_Tools.cpp 303040 2012-08-23 21:04:16Z brooks $

--- tools/clang/lib/Driver/Tools.cpp.orig
+++ tools/clang/lib/Driver/Tools.cpp
@@ -5119,17 +5119,48 @@

   // When building 32-bit code on FreeBSD/amd64, we have to explicitly
   // instruct as in the base system to assemble 32-bit code.
- if (getToolChain().getArchName() == "i386")
+ if (getToolChain().getArch() == llvm::Triple::x86)
     CmdArgs.push_back("--32");

Any chance I could persuade someone to commit this change?

Thanks,
Brooks

Looks fairly reasonable. Didn't see a test though if you don't mind?

-eric

Here you go. The following diff assumes that mips-as.c is copied to
freebsd-mips-as.c before being applied.

-- Brooks

Index: freebsd.c

Hi,

Sure, here's a new patch (it also contains a test for linkage in the -pg
on FreeBSD, but that can be trimmed and committed later if desired).

-- Brooks

Index: freebsd.c

You'll want to attach diffs as attachments and also run svn diff with -uNp
for unified diffs that include new files.

-eric

Here is an updated diff. I'd prefer that mips-as.c be svn cp'd to
freebsd-mips-as.c so the repository reflects who created the majority of
the contents but I don't know what llvm project policy is and have
attached a diff created with -x -up --show-copies-as-adds.

-- Brooks

clang-mips-driver.diff.txt (7.49 KB)

Looks good. Do you need me to apply?

-eric

Yes please! I don't have commit access.

Thanks,
Brooks

Applied here: http://llvm.org/viewvc/llvm-project?rev=163249&view=rev

-eric