[PATCH] D12201: [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.
Douglas Katzman via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 20 11:23:16 PDT 2015
dougk created this revision.
dougk added a reviewer: jyknight.
dougk added a subscriber: cfe-commits.
http://reviews.llvm.org/D12201
Files:
lib/Driver/Tools.cpp
test/Driver/biarch.c
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
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");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12201.32715.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150820/19e6b219/attachment.bin>
More information about the cfe-commits
mailing list