r245595 - [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:32:27 PDT 2015


Author: dougk
Date: Thu Aug 20 13:32:26 2015
New Revision: 245595

URL: http://llvm.org/viewvc/llvm-project?rev=245595&view=rev
Log:
[Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

Differential Revision: http://reviews.llvm.org/D12201

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245595&r1=245594&r2=245595&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 20 13:32:26 2015
@@ -5617,12 +5617,22 @@ void gcc::Common::ConstructJob(Compilati
   //
   // 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");

Modified: cfe/trunk/test/Driver/biarch.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=245595&r1=245594&r2=245595&view=diff
==============================================================================
--- cfe/trunk/test/Driver/biarch.c (original)
+++ cfe/trunk/test/Driver/biarch.c Thu Aug 20 13:32:26 2015
@@ -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
 




More information about the cfe-commits mailing list