[llvm] r236455 - Respect object format choice on Darwin
Keno Fischer
kfischer at college.harvard.edu
Mon May 4 13:03:01 PDT 2015
Author: kfischer
Date: Mon May 4 15:03:01 2015
New Revision: 236455
URL: http://llvm.org/viewvc/llvm-project?rev=236455&view=rev
Log:
Respect object format choice on Darwin
Summary:
The object format can be set to something other than MachO, e.g.
to use ELF-on-Darwin for MCJIT. This already works on Windows, so
there's no reason it shouldn't on Darwin.
Reviewers: lhames, grosbach
Subscribers: rafael, grosbach, t.p.northover, llvm-commits
Differential Revision: http://reviews.llvm.org/D6185
Modified:
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
llvm/trunk/test/MC/ELF/empty.s
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=236455&r1=236454&r2=236455&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Mon May 4 15:03:01 2015
@@ -754,7 +754,7 @@ void MCObjectFileInfo::InitMCObjectFileI
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 ||
Modified: llvm/trunk/test/MC/ELF/empty.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/empty.s?rev=236455&r1=236454&r2=236455&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/empty.s (original)
+++ llvm/trunk/test/MC/ELF/empty.s Mon May 4 15:03:01 2015
@@ -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.
More information about the llvm-commits
mailing list