[PATCH] Respect object format choice on Darwin

Keno Fischer kfischer at college.harvard.edu
Fri May 1 17:53:56 PDT 2015


Updated with test case.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6185

Files:
  lib/MC/MCObjectFileInfo.cpp
  test/MC/ELF/empty.s

Index: lib/MC/MCObjectFileInfo.cpp
===================================================================
--- lib/MC/MCObjectFileInfo.cpp
+++ lib/MC/MCObjectFileInfo.cpp
@@ -754,7 +754,7 @@
        Arch == Triple::aarch64 ||
        Arch == Triple::ppc || Arch == Triple::ppc64 ||
        Arch == Triple::UnknownArch) &&
-      (TT.isOSDarwin() || TT.isOSBinFormatMachO())) {
+       TT.isOSBinFormatMachO()) {
     Env = IsMachO;
     InitMachOMCObjectFileInfo(TT);
   } else if ((Arch == Triple::x86 || Arch == Triple::x86_64 ||
Index: test/MC/ELF/empty.s
===================================================================
--- test/MC/ELF/empty.s
+++ test/MC/ELF/empty.s
@@ -1,4 +1,14 @@
 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s | FileCheck %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-apple-darwin14.0.0-elf %s -o - | llvm-readobj -s | FileCheck %s -check-prefix=DARWIN
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32-elf %s -o - | llvm-readobj -s | FileCheck %s -check-prefix=WINDOWS
+
+// Check that we can create ELF files for darwin/windows, even though
+// it is not the default file format.
+
+// DARWIN:       Format: ELF64-x86-64
+// WINDOWS:      Format: ELF64-x86-64
+// DARWIN-NEXT:  Arch: x86_64
+// WINDOWS-NEXT: Arch: x86_64
 
 // Test that like gnu as we create text, data and bss by default. Also test
 // that shstrtab, symtab and strtab are listed.

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6185.24847.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150502/6ff016b0/attachment.bin>


More information about the llvm-commits mailing list