blob: 338fad8e0b1eca6a088e09ec95b17cf01c645c69 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//===-- AArch64MachObjectWriter.cpp - ARM Mach Object Writer --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "MCTargetDesc/AArch64FixupKinds.h"
11#include "MCTargetDesc/AArch64MCTargetDesc.h"
Benjamin Kramer1f8930e2014-07-25 11:42:14 +000012#include "llvm/ADT/Twine.h"
Rafael Espindola26585542015-01-19 21:11:14 +000013#include "llvm/MC/MCAsmInfo.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000014#include "llvm/MC/MCAsmLayout.h"
Benjamin Kramer1f8930e2014-07-25 11:42:14 +000015#include "llvm/MC/MCAssembler.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000016#include "llvm/MC/MCContext.h"
17#include "llvm/MC/MCExpr.h"
18#include "llvm/MC/MCFixup.h"
19#include "llvm/MC/MCMachObjectWriter.h"
20#include "llvm/MC/MCSectionMachO.h"
21#include "llvm/MC/MCValue.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000022#include "llvm/Support/ErrorHandling.h"
23#include "llvm/Support/MachO.h"
24using namespace llvm;
25
26namespace {
27class AArch64MachObjectWriter : public MCMachObjectTargetWriter {
28 bool getAArch64FixupKindMachOInfo(const MCFixup &Fixup, unsigned &RelocType,
29 const MCSymbolRefExpr *Sym,
30 unsigned &Log2Size, const MCAssembler &Asm);
31
32public:
33 AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
34 : MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype,
35 /*UseAggressiveSymbolFolding=*/true) {}
36
Rafael Espindola26585542015-01-19 21:11:14 +000037 void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
Tim Northover3b0846e2014-05-24 12:50:23 +000038 const MCAsmLayout &Layout, const MCFragment *Fragment,
39 const MCFixup &Fixup, MCValue Target,
40 uint64_t &FixedValue) override;
41};
42}
43
44bool AArch64MachObjectWriter::getAArch64FixupKindMachOInfo(
45 const MCFixup &Fixup, unsigned &RelocType, const MCSymbolRefExpr *Sym,
46 unsigned &Log2Size, const MCAssembler &Asm) {
47 RelocType = unsigned(MachO::ARM64_RELOC_UNSIGNED);
48 Log2Size = ~0U;
49
50 switch ((unsigned)Fixup.getKind()) {
51 default:
52 return false;
53
54 case FK_Data_1:
55 Log2Size = llvm::Log2_32(1);
56 return true;
57 case FK_Data_2:
58 Log2Size = llvm::Log2_32(2);
59 return true;
60 case FK_Data_4:
61 Log2Size = llvm::Log2_32(4);
62 if (Sym->getKind() == MCSymbolRefExpr::VK_GOT)
63 RelocType = unsigned(MachO::ARM64_RELOC_POINTER_TO_GOT);
64 return true;
65 case FK_Data_8:
66 Log2Size = llvm::Log2_32(8);
67 if (Sym->getKind() == MCSymbolRefExpr::VK_GOT)
68 RelocType = unsigned(MachO::ARM64_RELOC_POINTER_TO_GOT);
69 return true;
70 case AArch64::fixup_aarch64_add_imm12:
71 case AArch64::fixup_aarch64_ldst_imm12_scale1:
72 case AArch64::fixup_aarch64_ldst_imm12_scale2:
73 case AArch64::fixup_aarch64_ldst_imm12_scale4:
74 case AArch64::fixup_aarch64_ldst_imm12_scale8:
75 case AArch64::fixup_aarch64_ldst_imm12_scale16:
76 Log2Size = llvm::Log2_32(4);
77 switch (Sym->getKind()) {
78 default:
Craig Topper2a30d782014-06-18 05:05:13 +000079 llvm_unreachable("Unexpected symbol reference variant kind!");
Tim Northover3b0846e2014-05-24 12:50:23 +000080 case MCSymbolRefExpr::VK_PAGEOFF:
81 RelocType = unsigned(MachO::ARM64_RELOC_PAGEOFF12);
82 return true;
83 case MCSymbolRefExpr::VK_GOTPAGEOFF:
84 RelocType = unsigned(MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12);
85 return true;
86 case MCSymbolRefExpr::VK_TLVPPAGEOFF:
87 RelocType = unsigned(MachO::ARM64_RELOC_TLVP_LOAD_PAGEOFF12);
88 return true;
89 }
90 case AArch64::fixup_aarch64_pcrel_adrp_imm21:
91 Log2Size = llvm::Log2_32(4);
92 // This encompasses the relocation for the whole 21-bit value.
93 switch (Sym->getKind()) {
94 default:
Jim Grosbach6f482002015-05-18 18:43:14 +000095 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +000096 "ADR/ADRP relocations must be GOT relative");
97 case MCSymbolRefExpr::VK_PAGE:
98 RelocType = unsigned(MachO::ARM64_RELOC_PAGE21);
99 return true;
100 case MCSymbolRefExpr::VK_GOTPAGE:
101 RelocType = unsigned(MachO::ARM64_RELOC_GOT_LOAD_PAGE21);
102 return true;
103 case MCSymbolRefExpr::VK_TLVPPAGE:
104 RelocType = unsigned(MachO::ARM64_RELOC_TLVP_LOAD_PAGE21);
105 return true;
106 }
107 return true;
108 case AArch64::fixup_aarch64_pcrel_branch26:
109 case AArch64::fixup_aarch64_pcrel_call26:
110 Log2Size = llvm::Log2_32(4);
111 RelocType = unsigned(MachO::ARM64_RELOC_BRANCH26);
112 return true;
113 }
114}
115
Rafael Espindola26585542015-01-19 21:11:14 +0000116static bool canUseLocalRelocation(const MCSectionMachO &Section,
117 const MCSymbol &Symbol, unsigned Log2Size) {
118 // Debug info sections can use local relocations.
119 if (Section.hasAttribute(MachO::S_ATTR_DEBUG))
120 return true;
121
122 // Otherwise, only pointer sized relocations are supported.
123 if (Log2Size != 3)
124 return false;
125
126 // But only if they don't point to a few forbidden sections.
127 if (!Symbol.isInSection())
128 return true;
129 const MCSectionMachO &RefSec = cast<MCSectionMachO>(Symbol.getSection());
130 if (RefSec.getType() == MachO::S_CSTRING_LITERALS)
131 return false;
132
133 if (RefSec.getSegmentName() == "__DATA" &&
Rafael Espindolae4bcad42015-02-12 23:11:59 +0000134 RefSec.getSectionName() == "__objc_classrefs")
135 return false;
136
Tim Northoverd6223a22015-05-18 22:07:20 +0000137 // FIXME: ld64 currently handles internal pointer-sized relocations
138 // incorrectly (applying the addend twice). We should be able to return true
139 // unconditionally by this point when that's fixed.
140 return false;
Rafael Espindola26585542015-01-19 21:11:14 +0000141}
142
Tim Northover3b0846e2014-05-24 12:50:23 +0000143void AArch64MachObjectWriter::RecordRelocation(
Rafael Espindola26585542015-01-19 21:11:14 +0000144 MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout,
Tim Northover3b0846e2014-05-24 12:50:23 +0000145 const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,
146 uint64_t &FixedValue) {
147 unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
148
149 // See <reloc.h>.
150 uint32_t FixupOffset = Layout.getFragmentOffset(Fragment);
151 unsigned Log2Size = 0;
152 int64_t Value = 0;
153 unsigned Index = 0;
Tim Northover3b0846e2014-05-24 12:50:23 +0000154 unsigned Type = 0;
155 unsigned Kind = Fixup.getKind();
Duncan P. N. Exon Smith09bfa582015-05-16 00:48:58 +0000156 const MCSymbol *RelSymbol = nullptr;
Tim Northover3b0846e2014-05-24 12:50:23 +0000157
158 FixupOffset += Fixup.getOffset();
159
160 // AArch64 pcrel relocation addends do not include the section offset.
161 if (IsPCRel)
162 FixedValue += FixupOffset;
163
164 // ADRP fixups use relocations for the whole symbol value and only
165 // put the addend in the instruction itself. Clear out any value the
166 // generic code figured out from the sybmol definition.
167 if (Kind == AArch64::fixup_aarch64_pcrel_adrp_imm21)
168 FixedValue = 0;
169
170 // imm19 relocations are for conditional branches, which require
171 // assembler local symbols. If we got here, that's not what we have,
172 // so complain loudly.
173 if (Kind == AArch64::fixup_aarch64_pcrel_branch19) {
Jim Grosbach6f482002015-05-18 18:43:14 +0000174 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000175 "conditional branch requires assembler-local"
176 " label. '" +
177 Target.getSymA()->getSymbol().getName() +
178 "' is external.");
179 return;
180 }
181
182 // 14-bit branch relocations should only target internal labels, and so
183 // should never get here.
184 if (Kind == AArch64::fixup_aarch64_pcrel_branch14) {
Jim Grosbach6f482002015-05-18 18:43:14 +0000185 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000186 "Invalid relocation on conditional branch!");
187 return;
188 }
189
190 if (!getAArch64FixupKindMachOInfo(Fixup, Type, Target.getSymA(), Log2Size,
191 Asm)) {
Jim Grosbach6f482002015-05-18 18:43:14 +0000192 Asm.getContext().reportFatalError(Fixup.getLoc(), "unknown AArch64 fixup kind!");
Tim Northover3b0846e2014-05-24 12:50:23 +0000193 return;
194 }
195
196 Value = Target.getConstant();
197
198 if (Target.isAbsolute()) { // constant
199 // FIXME: Should this always be extern?
200 // SymbolNum of 0 indicates the absolute section.
201 Type = MachO::ARM64_RELOC_UNSIGNED;
Tim Northover3b0846e2014-05-24 12:50:23 +0000202
203 if (IsPCRel) {
Jim Grosbach6f482002015-05-18 18:43:14 +0000204 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000205 "PC relative absolute relocation!");
206
207 // FIXME: x86_64 sets the type to a branch reloc here. Should we do
208 // something similar?
209 }
210 } else if (Target.getSymB()) { // A - B + constant
211 const MCSymbol *A = &Target.getSymA()->getSymbol();
Duncan P. N. Exon Smithfd27a1d2015-05-20 16:02:11 +0000212 const MCSymbol *A_Base = Asm.getAtom(*A);
Tim Northover3b0846e2014-05-24 12:50:23 +0000213
214 const MCSymbol *B = &Target.getSymB()->getSymbol();
Duncan P. N. Exon Smithfd27a1d2015-05-20 16:02:11 +0000215 const MCSymbol *B_Base = Asm.getAtom(*B);
Tim Northover3b0846e2014-05-24 12:50:23 +0000216
217 // Check for "_foo@got - .", which comes through here as:
218 // Ltmp0:
219 // ... _foo@got - Ltmp0
220 if (Target.getSymA()->getKind() == MCSymbolRefExpr::VK_GOT &&
221 Target.getSymB()->getKind() == MCSymbolRefExpr::VK_None &&
Duncan P. N. Exon Smith2a404832015-05-19 23:53:20 +0000222 Layout.getSymbolOffset(*B) ==
Tim Northover3b0846e2014-05-24 12:50:23 +0000223 Layout.getFragmentOffset(Fragment) + Fixup.getOffset()) {
224 // SymB is the PC, so use a PC-rel pointer-to-GOT relocation.
Tim Northover3b0846e2014-05-24 12:50:23 +0000225 Type = MachO::ARM64_RELOC_POINTER_TO_GOT;
226 IsPCRel = 1;
227 MachO::any_relocation_info MRE;
228 MRE.r_word0 = FixupOffset;
Rafael Espindola26585542015-01-19 21:11:14 +0000229 MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
Rafael Espindola61e724a2015-05-26 01:15:30 +0000230 Writer->addRelocation(A_Base, Fragment->getParent(), MRE);
Tim Northover3b0846e2014-05-24 12:50:23 +0000231 return;
232 } else if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None ||
233 Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None)
234 // Otherwise, neither symbol can be modified.
Jim Grosbach6f482002015-05-18 18:43:14 +0000235 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000236 "unsupported relocation of modified symbol");
237
238 // We don't support PCrel relocations of differences.
239 if (IsPCRel)
Jim Grosbach6f482002015-05-18 18:43:14 +0000240 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000241 "unsupported pc-relative relocation of "
242 "difference");
243
244 // AArch64 always uses external relocations. If there is no symbol to use as
245 // a base address (a local symbol with no preceding non-local symbol),
246 // error out.
247 //
248 // FIXME: We should probably just synthesize an external symbol and use
249 // that.
250 if (!A_Base)
Jim Grosbach6f482002015-05-18 18:43:14 +0000251 Asm.getContext().reportFatalError(
Tim Northover3b0846e2014-05-24 12:50:23 +0000252 Fixup.getLoc(),
253 "unsupported relocation of local symbol '" + A->getName() +
254 "'. Must have non-local symbol earlier in section.");
255 if (!B_Base)
Jim Grosbach6f482002015-05-18 18:43:14 +0000256 Asm.getContext().reportFatalError(
Tim Northover3b0846e2014-05-24 12:50:23 +0000257 Fixup.getLoc(),
258 "unsupported relocation of local symbol '" + B->getName() +
259 "'. Must have non-local symbol earlier in section.");
260
261 if (A_Base == B_Base && A_Base)
Jim Grosbach6f482002015-05-18 18:43:14 +0000262 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000263 "unsupported relocation with identical base");
264
Rafael Espindola4d37b2a2015-05-29 21:45:01 +0000265 Value += (!A->getFragment() ? 0 : Writer->getSymbolAddress(*A, Layout)) -
266 (!A_Base || !A_Base->getFragment() ? 0 : Writer->getSymbolAddress(
267 *A_Base, Layout));
268 Value -= (!B->getFragment() ? 0 : Writer->getSymbolAddress(*B, Layout)) -
269 (!B_Base || !B_Base->getFragment() ? 0 : Writer->getSymbolAddress(
270 *B_Base, Layout));
Tim Northover3b0846e2014-05-24 12:50:23 +0000271
Tim Northover3b0846e2014-05-24 12:50:23 +0000272 Type = MachO::ARM64_RELOC_UNSIGNED;
273
274 MachO::any_relocation_info MRE;
275 MRE.r_word0 = FixupOffset;
Rafael Espindola26585542015-01-19 21:11:14 +0000276 MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
Rafael Espindola61e724a2015-05-26 01:15:30 +0000277 Writer->addRelocation(A_Base, Fragment->getParent(), MRE);
Tim Northover3b0846e2014-05-24 12:50:23 +0000278
Rafael Espindola26585542015-01-19 21:11:14 +0000279 RelSymbol = B_Base;
Tim Northover3b0846e2014-05-24 12:50:23 +0000280 Type = MachO::ARM64_RELOC_SUBTRACTOR;
281 } else { // A + constant
282 const MCSymbol *Symbol = &Target.getSymA()->getSymbol();
Rafael Espindola7549f872015-05-26 00:36:57 +0000283 const MCSectionMachO &Section =
284 static_cast<const MCSectionMachO &>(*Fragment->getParent());
Rafael Espindolad9c3e302015-01-12 18:13:07 +0000285
Rafael Espindola26585542015-01-19 21:11:14 +0000286 bool CanUseLocalRelocation =
287 canUseLocalRelocation(Section, *Symbol, Log2Size);
288 if (Symbol->isTemporary() && (Value || !CanUseLocalRelocation)) {
289 const MCSection &Sec = Symbol->getSection();
290 if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
291 Asm.addLocalUsedInReloc(*Symbol);
292 }
293
Duncan P. N. Exon Smithfd27a1d2015-05-20 16:02:11 +0000294 const MCSymbol *Base = Asm.getAtom(*Symbol);
Rafael Espindola26585542015-01-19 21:11:14 +0000295
Tim Northover3b0846e2014-05-24 12:50:23 +0000296 // If the symbol is a variable and we weren't able to get a Base for it
297 // (i.e., it's not in the symbol table associated with a section) resolve
298 // the relocation based its expansion instead.
299 if (Symbol->isVariable() && !Base) {
300 // If the evaluation is an absolute value, just use that directly
301 // to keep things easy.
302 int64_t Res;
Jim Grosbach13760bd2015-05-30 01:25:56 +0000303 if (Symbol->getVariableValue()->evaluateAsAbsolute(
Tim Northover3b0846e2014-05-24 12:50:23 +0000304 Res, Layout, Writer->getSectionAddressMap())) {
305 FixedValue = Res;
306 return;
307 }
308
309 // FIXME: Will the Target we already have ever have any data in it
310 // we need to preserve and merge with the new Target? How about
311 // the FixedValue?
Jim Grosbach13760bd2015-05-30 01:25:56 +0000312 if (!Symbol->getVariableValue()->evaluateAsRelocatable(Target, &Layout,
Joerg Sonnenberger752b91b2014-08-10 11:35:12 +0000313 &Fixup))
Jim Grosbach6f482002015-05-18 18:43:14 +0000314 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000315 "unable to resolve variable '" +
316 Symbol->getName() + "'");
317 return RecordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
318 FixedValue);
319 }
320
321 // Relocations inside debug sections always use local relocations when
322 // possible. This seems to be done because the debugger doesn't fully
323 // understand relocation entries and expects to find values that
324 // have already been fixed up.
325 if (Symbol->isInSection()) {
326 if (Section.hasAttribute(MachO::S_ATTR_DEBUG))
327 Base = nullptr;
328 }
329
330 // AArch64 uses external relocations as much as possible. For debug
331 // sections, and for pointer-sized relocations (.quad), we allow section
332 // relocations. It's code sections that run into trouble.
333 if (Base) {
Rafael Espindola26585542015-01-19 21:11:14 +0000334 RelSymbol = Base;
Tim Northover3b0846e2014-05-24 12:50:23 +0000335
336 // Add the local offset, if needed.
Duncan P. N. Exon Smith2a404832015-05-19 23:53:20 +0000337 if (Base != Symbol)
338 Value +=
339 Layout.getSymbolOffset(*Symbol) - Layout.getSymbolOffset(*Base);
Tim Northover3b0846e2014-05-24 12:50:23 +0000340 } else if (Symbol->isInSection()) {
Rafael Espindola26585542015-01-19 21:11:14 +0000341 if (!CanUseLocalRelocation)
Jim Grosbach6f482002015-05-18 18:43:14 +0000342 Asm.getContext().reportFatalError(
Tim Northover3b0846e2014-05-24 12:50:23 +0000343 Fixup.getLoc(),
344 "unsupported relocation of local symbol '" + Symbol->getName() +
345 "'. Must have non-local symbol earlier in section.");
346 // Adjust the relocation to be section-relative.
347 // The index is the section ordinal (1-based).
Rafael Espindola6e6820a2015-05-25 14:12:48 +0000348 const MCSection &Sec = Symbol->getSection();
349 Index = Sec.getOrdinal() + 1;
Duncan P. N. Exon Smith92a699c2015-05-20 20:18:16 +0000350 Value += Writer->getSymbolAddress(*Symbol, Layout);
Tim Northover3b0846e2014-05-24 12:50:23 +0000351
352 if (IsPCRel)
353 Value -= Writer->getFragmentAddress(Fragment, Layout) +
354 Fixup.getOffset() + (1ULL << Log2Size);
355 } else {
356 // Resolve constant variables.
Duncan P. N. Exon Smith92a699c2015-05-20 20:18:16 +0000357 if (Symbol->isVariable()) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000358 int64_t Res;
Jim Grosbach13760bd2015-05-30 01:25:56 +0000359 if (Symbol->getVariableValue()->evaluateAsAbsolute(
Tim Northover3b0846e2014-05-24 12:50:23 +0000360 Res, Layout, Writer->getSectionAddressMap())) {
361 FixedValue = Res;
362 return;
363 }
364 }
Jim Grosbach6f482002015-05-18 18:43:14 +0000365 Asm.getContext().reportFatalError(Fixup.getLoc(),
Tim Northover3b0846e2014-05-24 12:50:23 +0000366 "unsupported relocation of variable '" +
367 Symbol->getName() + "'");
368 }
369 }
370
371 // If the relocation kind is Branch26, Page21, or Pageoff12, any addend
372 // is represented via an Addend relocation, not encoded directly into
373 // the instruction.
374 if ((Type == MachO::ARM64_RELOC_BRANCH26 ||
375 Type == MachO::ARM64_RELOC_PAGE21 ||
376 Type == MachO::ARM64_RELOC_PAGEOFF12) &&
377 Value) {
378 assert((Value & 0xff000000) == 0 && "Added relocation out of range!");
379
380 MachO::any_relocation_info MRE;
381 MRE.r_word0 = FixupOffset;
Rafael Espindola26585542015-01-19 21:11:14 +0000382 MRE.r_word1 =
383 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
Rafael Espindola61e724a2015-05-26 01:15:30 +0000384 Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);
Tim Northover3b0846e2014-05-24 12:50:23 +0000385
386 // Now set up the Addend relocation.
387 Type = MachO::ARM64_RELOC_ADDEND;
388 Index = Value;
Rafael Espindola26585542015-01-19 21:11:14 +0000389 RelSymbol = nullptr;
Tim Northover3b0846e2014-05-24 12:50:23 +0000390 IsPCRel = 0;
391 Log2Size = 2;
Tim Northover3b0846e2014-05-24 12:50:23 +0000392
393 // Put zero into the instruction itself. The addend is in the relocation.
394 Value = 0;
395 }
396
397 // If there's any addend left to handle, encode it in the instruction.
398 FixedValue = Value;
399
400 // struct relocation_info (8 bytes)
401 MachO::any_relocation_info MRE;
402 MRE.r_word0 = FixupOffset;
Rafael Espindola26585542015-01-19 21:11:14 +0000403 MRE.r_word1 =
404 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
Rafael Espindola61e724a2015-05-26 01:15:30 +0000405 Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);
Tim Northover3b0846e2014-05-24 12:50:23 +0000406}
407
Rafael Espindola5560a4c2015-04-14 22:14:34 +0000408MCObjectWriter *llvm::createAArch64MachObjectWriter(raw_pwrite_stream &OS,
Rafael Espindola49286e92015-04-09 18:32:58 +0000409 uint32_t CPUType,
410 uint32_t CPUSubtype) {
Tim Northover3b0846e2014-05-24 12:50:23 +0000411 return createMachObjectWriter(
412 new AArch64MachObjectWriter(CPUType, CPUSubtype), OS,
413 /*IsLittleEndian=*/true);
414}