From 31b680fa246e4b5fcd24c79876e900d7d6ca0a97 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 12 Jun 2015 23:37:11 +0000 Subject: [PATCH] AArch64: map bare-metal arm64-macho triple to MachO MC layer. Far better than an assertion about expecting ELF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239647 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../AArch64/MCTargetDesc/AArch64AsmBackend.cpp | 2 +- .../AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp | 2 +- test/CodeGen/AArch64/simple-macho.ll | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/AArch64/simple-macho.ll diff --git a/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp index f979fa8e5aa..7624c7240d6 100644 --- a/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp +++ b/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp @@ -523,7 +523,7 @@ MCAsmBackend *llvm::createAArch64leAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TheTriple, StringRef CPU) { - if (TheTriple.isOSDarwin()) + if (TheTriple.isOSBinFormatMachO()) return new DarwinAArch64AsmBackend(T, MRI); assert(TheTriple.isOSBinFormatELF() && "Expect either MachO or ELF target"); diff --git a/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp b/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp index b08cd999a3c..099d1b01c33 100644 --- a/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp +++ b/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp @@ -60,7 +60,7 @@ static MCRegisterInfo *createAArch64MCRegisterInfo(StringRef Triple) { static MCAsmInfo *createAArch64MCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple) { MCAsmInfo *MAI; - if (TheTriple.isOSDarwin()) + if (TheTriple.isOSBinFormatMachO()) MAI = new AArch64MCAsmInfoDarwin(); else { assert(TheTriple.isOSBinFormatELF() && "Only expect Darwin or ELF"); diff --git a/test/CodeGen/AArch64/simple-macho.ll b/test/CodeGen/AArch64/simple-macho.ll new file mode 100644 index 00000000000..e9dd98e230d --- /dev/null +++ b/test/CodeGen/AArch64/simple-macho.ll @@ -0,0 +1,12 @@ +; RUN: llc -mtriple=arm64-macho -o - %s | FileCheck %s +; RUN: llc -mtriple=arm64-macho -filetype=obj -o %t %s +; RUN: llvm-objdump -triple=arm64-macho -d %t | FileCheck --check-prefix=CHECK-OBJ %s + +define void @foo() { +; CHECK-LABEL: _foo: +; CHECK: ret + +; CHECK-OBJ: 0: c0 03 5f d6 ret + + ret void +} \ No newline at end of file