Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -5617,12 +5617,22 @@ // // FIXME: The triple class should directly provide the information we want // here. - const llvm::Triple::ArchType Arch = getToolChain().getArch(); - if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc) + switch (getToolChain().getArch()) { + default: + break; + case llvm::Triple::x86: + case llvm::Triple::ppc: CmdArgs.push_back("-m32"); - else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 || - Arch == llvm::Triple::ppc64le) + break; + case llvm::Triple::x86_64: + case llvm::Triple::ppc64: + case llvm::Triple::ppc64le: CmdArgs.push_back("-m64"); + break; + case llvm::Triple::sparcel: + CmdArgs.push_back("-EL"); + break; + } if (Output.isFilename()) { CmdArgs.push_back("-o"); Index: test/Driver/biarch.c =================================================================== --- test/Driver/biarch.c +++ test/Driver/biarch.c @@ -28,6 +28,9 @@ // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t +// RUN: %clang -target sparcel -o foo %s -### 2> %t +// RUN: grep 'gcc" "-EL" "-o" "foo"' %t + // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t