Teach getDefaultFormat that we only support ELF on some architectures.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 18 Mar 2015 22:19:16 +0000 (22:19 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 18 Mar 2015 22:19:16 +0000 (22:19 +0000)
This should bring the windows bots back.

It is a bit ugly, but it is better than what we had before: The triple would
say that the object format was COFF, but llc/llvm-mc would produce an ELF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232683 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Triple.cpp
test/CodeGen/R600/elf.ll

index d74173a6621deea2fd4f07c1369ed92f9d66637c..4b4ee283e64b1186a522d841b5304ceaade311e7 100644 (file)
@@ -439,6 +439,23 @@ static const char *getObjectFormatTypeName(Triple::ObjectFormatType Kind) {
 }
 
 static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
 }
 
 static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
+  switch (T.getArch()) {
+  default:
+    break;
+  case Triple::hexagon:
+  case Triple::mips:
+  case Triple::mipsel:
+  case Triple::mips64:
+  case Triple::mips64el:
+  case Triple::r600:
+  case Triple::amdgcn:
+  case Triple::sparc:
+  case Triple::sparcv9:
+  case Triple::systemz:
+  case Triple::xcore:
+    return Triple::ELF;
+  }
+
   if (T.isOSDarwin())
     return Triple::MachO;
   else if (T.isOSWindows())
   if (T.isOSDarwin())
     return Triple::MachO;
   else if (T.isOSWindows())
index 127da2c8accffdc62b68fd6620f1fb5a9e94e058..d0fd06a3437985ecd8036adf91936db61549b5e9 100644 (file)
@@ -5,6 +5,9 @@
 ; RUN: llc < %s -march=amdgcn -mcpu=carrizo -verify-machineinstrs -filetype=obj | llvm-readobj -s -symbols - | FileCheck --check-prefix=ELF %s
 ; RUN: llc < %s -march=amdgcn -mcpu=carrizo -verify-machineinstrs -o - | FileCheck --check-prefix=CONFIG --check-prefix=TYPICAL %s
 
 ; RUN: llc < %s -march=amdgcn -mcpu=carrizo -verify-machineinstrs -filetype=obj | llvm-readobj -s -symbols - | FileCheck --check-prefix=ELF %s
 ; RUN: llc < %s -march=amdgcn -mcpu=carrizo -verify-machineinstrs -o - | FileCheck --check-prefix=CONFIG --check-prefix=TYPICAL %s
 
+; Test that we don't try to produce a COFF file on windows
+; RUN: llc < %s -mtriple=amdgcn-pc-mingw -mcpu=SI -verify-machineinstrs -filetype=obj | llvm-readobj -s -symbols - | FileCheck --check-prefix=ELF %s
+
 ; ELF: Format: ELF32
 ; ELF: Name: .AMDGPU.config
 ; ELF: Type: SHT_PROGBITS
 ; ELF: Format: ELF32
 ; ELF: Name: .AMDGPU.config
 ; ELF: Type: SHT_PROGBITS