[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:33:28 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL245595: [Sparc] Add '-EL' when invoking gcc to link little-endian binaries. (authored by dougk).

Changed prior to commit:
  http://reviews.llvm.org/D12201?vs=32715&id=32716#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12201

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/biarch.c

Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/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: cfe/trunk/test/Driver/biarch.c
===================================================================
--- cfe/trunk/test/Driver/biarch.c
+++ cfe/trunk/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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12201.32716.patch
Type: text/x-patch
Size: 1492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150820/b2694faf/attachment.bin>


More information about the cfe-commits mailing list