LLVM 20.0.0git
MCObjectStreamer.cpp
Go to the documentation of this file.
1//===- lib/MC/MCObjectStreamer.cpp - Object File MCStreamer Interface -----===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "llvm/MC/MCAsmInfo.h"
12#include "llvm/MC/MCAssembler.h"
14#include "llvm/MC/MCCodeView.h"
15#include "llvm/MC/MCContext.h"
16#include "llvm/MC/MCDwarf.h"
17#include "llvm/MC/MCExpr.h"
20#include "llvm/MC/MCSection.h"
21#include "llvm/MC/MCSymbol.h"
22#include "llvm/MC/MCValue.h"
25using namespace llvm;
26
28 std::unique_ptr<MCAsmBackend> TAB,
29 std::unique_ptr<MCObjectWriter> OW,
30 std::unique_ptr<MCCodeEmitter> Emitter)
31 : MCStreamer(Context),
32 Assembler(std::make_unique<MCAssembler>(
33 Context, std::move(TAB), std::move(Emitter), std::move(OW))),
34 EmitEHFrame(true), EmitDebugFrame(false) {
35 assert(Assembler->getBackendPtr() && Assembler->getEmitterPtr());
36 setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
37 if (Context.getTargetOptions() && Context.getTargetOptions()->MCRelaxAll)
38 Assembler->setRelaxAll(true);
39}
40
42
45 return Assembler.get();
46 return nullptr;
47}
48
49// When fixup's offset is a forward declared label, e.g.:
50//
51// .reloc 1f, R_MIPS_JALR, foo
52// 1: nop
53//
54// postpone adding it to Fixups vector until the label is defined and its offset
55// is known.
56void MCObjectStreamer::resolvePendingFixups() {
57 for (PendingMCFixup &PendingFixup : PendingFixups) {
58 if (!PendingFixup.Sym || PendingFixup.Sym->isUndefined ()) {
59 getContext().reportError(PendingFixup.Fixup.getLoc(),
60 "unresolved relocation offset");
61 continue;
62 }
63 PendingFixup.Fixup.setOffset(PendingFixup.Sym->getOffset() +
64 PendingFixup.Fixup.getOffset());
65
66 // If the location symbol to relocate is in MCEncodedFragmentWithFixups,
67 // put the Fixup into location symbol's fragment. Otherwise
68 // put into PendingFixup.DF
69 MCFragment *SymFragment = PendingFixup.Sym->getFragment();
70 switch (SymFragment->getKind()) {
74 cast<MCEncodedFragmentWithFixups<8, 1>>(SymFragment)
75 ->getFixups()
76 .push_back(PendingFixup.Fixup);
77 break;
80 cast<MCEncodedFragmentWithFixups<32, 4>>(SymFragment)
81 ->getFixups()
82 .push_back(PendingFixup.Fixup);
83 break;
84 default:
85 PendingFixup.DF->getFixups().push_back(PendingFixup.Fixup);
86 break;
87 }
88 }
89 PendingFixups.clear();
90}
91
92// As a compile-time optimization, avoid allocating and evaluating an MCExpr
93// tree for (Hi - Lo) when Hi and Lo are offsets into the same fragment.
94static std::optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
95 const MCSymbol *Lo) {
96 assert(Hi && Lo);
97 if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() ||
98 Hi->isVariable() || Lo->isVariable())
99 return std::nullopt;
100
101 return Hi->getOffset() - Lo->getOffset();
102}
103
105 const MCSymbol *Lo,
106 unsigned Size) {
107 if (!getAssembler().getContext().getTargetTriple().isRISCV())
108 if (std::optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo))
109 return emitIntValue(*Diff, Size);
111}
112
114 const MCSymbol *Lo) {
115 if (!getAssembler().getContext().getTargetTriple().isRISCV())
116 if (std::optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo)) {
117 emitULEB128IntValue(*Diff);
118 return;
119 }
121}
122
124 if (Assembler) {
125 Assembler->reset();
126 if (getContext().getTargetOptions())
127 Assembler->setRelaxAll(getContext().getTargetOptions()->MCRelaxAll);
128 }
129 EmitEHFrame = true;
130 EmitDebugFrame = false;
132}
133
135 if (!getNumFrameInfos())
136 return;
137
138 if (EmitEHFrame)
139 MCDwarfFrameEmitter::Emit(*this, MAB, true);
140
141 if (EmitDebugFrame)
142 MCDwarfFrameEmitter::Emit(*this, MAB, false);
143}
144
146 const MCAssembler &Assembler,
147 const MCSubtargetInfo *STI) {
148 if (!F.hasInstructions())
149 return true;
150 // Do not add data after a linker-relaxable instruction. The difference
151 // between a new label and a label at or before the linker-relaxable
152 // instruction cannot be resolved at assemble-time.
153 if (F.isLinkerRelaxable())
154 return false;
155 // When bundling is enabled, we don't want to add data to a fragment that
156 // already has instructions (see MCELFStreamer::emitInstToData for details)
157 if (Assembler.isBundlingEnabled())
158 return false;
159 // If the subtarget is changed mid fragment we start a new fragment to record
160 // the new STI.
161 return !STI || F.getSubtargetInfo() == STI;
162}
163
166 auto *F = dyn_cast<MCDataFragment>(getCurrentFragment());
167 if (!F || !canReuseDataFragment(*F, *Assembler, STI)) {
169 insert(F);
170 }
171 return F;
172}
173
175 Assembler->registerSymbol(Sym);
176}
177
180 EmitEHFrame = EH;
181 EmitDebugFrame = Debug;
182}
183
185 SMLoc Loc) {
188
190
191 // Avoid fixups when possible.
192 int64_t AbsValue;
193 if (Value->evaluateAsAbsolute(AbsValue, getAssemblerPtr())) {
194 if (!isUIntN(8 * Size, AbsValue) && !isIntN(8 * Size, AbsValue)) {
196 Loc, "value evaluated as " + Twine(AbsValue) + " is out of range.");
197 return;
198 }
199 emitIntValue(AbsValue, Size);
200 return;
201 }
202 DF->getFixups().push_back(
203 MCFixup::create(DF->getContents().size(), Value,
204 MCFixup::getKindForSize(Size, false), Loc));
205 DF->getContents().resize(DF->getContents().size() + Size, 0);
206}
207
208MCSymbol *MCObjectStreamer::emitCFILabel() {
209 MCSymbol *Label = getContext().createTempSymbol("cfi");
210 emitLabel(Label);
211 return Label;
212}
213
214void MCObjectStreamer::emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
215 // We need to create a local symbol to avoid relocations.
217 emitLabel(Frame.Begin);
218}
219
220void MCObjectStreamer::emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
221 Frame.End = getContext().createTempSymbol();
222 emitLabel(Frame.End);
223}
224
226 MCStreamer::emitLabel(Symbol, Loc);
227
228 getAssembler().registerSymbol(*Symbol);
229
230 // If there is a current fragment, mark the symbol as pointing into it.
231 // Otherwise queue the label and set its fragment pointer when we emit the
232 // next fragment.
234 Symbol->setFragment(F);
235 Symbol->setOffset(F->getContents().size());
236
238}
239
241 auto Assignments = pendingAssignments.find(Symbol);
242 if (Assignments != pendingAssignments.end()) {
243 for (const PendingAssignment &A : Assignments->second)
244 emitAssignment(A.Symbol, A.Value);
245
246 pendingAssignments.erase(Assignments);
247 }
248}
249
250// Emit a label at a previously emitted fragment/offset position. This must be
251// within the currently-active section.
254 assert(F.getParent() == getCurrentSectionOnly());
255 MCStreamer::emitLabel(Symbol, Loc);
256 getAssembler().registerSymbol(*Symbol);
257 Symbol->setFragment(&F);
258 Symbol->setOffset(Offset);
259}
260
262 int64_t IntValue;
263 if (Value->evaluateAsAbsolute(IntValue, getAssemblerPtr())) {
264 emitULEB128IntValue(IntValue);
265 return;
266 }
267 insert(getContext().allocFragment<MCLEBFragment>(*Value, false));
268}
269
271 int64_t IntValue;
272 if (Value->evaluateAsAbsolute(IntValue, getAssemblerPtr())) {
273 emitSLEB128IntValue(IntValue);
274 return;
275 }
276 insert(getContext().allocFragment<MCLEBFragment>(*Value, true));
277}
278
280 const MCSymbol *Symbol) {
281 report_fatal_error("This file format doesn't support weak aliases.");
282}
283
285 changeSectionImpl(Section, Subsection);
286}
287
289 uint32_t Subsection) {
290 assert(Section && "Cannot switch to a null section!");
292
293 auto &Subsections = Section->Subsections;
294 size_t I = 0, E = Subsections.size();
295 while (I != E && Subsections[I].first < Subsection)
296 ++I;
297 // If the subsection number is not in the sorted Subsections list, create a
298 // new fragment list.
299 if (I == E || Subsections[I].first != Subsection) {
301 F->setParent(Section);
302 Subsections.insert(Subsections.begin() + I,
303 {Subsection, MCSection::FragList{F, F}});
304 }
305 Section->CurFragList = &Subsections[I].second;
306 CurFrag = Section->CurFragList->Tail;
307
308 return getAssembler().registerSection(*Section);
309}
310
313 changeSection(Section, 0);
314}
315
317 getAssembler().registerSymbol(*Symbol);
320}
321
323 const MCExpr *Value) {
324 const MCSymbol *Target = &cast<MCSymbolRefExpr>(*Value).getSymbol();
325
326 // If the symbol already exists, emit the assignment. Otherwise, emit it
327 // later only if the symbol is also emitted.
328 if (Target->isRegistered())
329 emitAssignment(Symbol, Value);
330 else
331 pendingAssignments[Target].push_back({Symbol, Value});
332}
333
335 return Sec.hasInstructions();
336}
337
339 const MCSubtargetInfo &STI) {
340 const MCSection &Sec = *getCurrentSectionOnly();
341 if (Sec.isVirtualSection()) {
343 " section '" + Sec.getName() +
344 "' cannot have instructions");
345 return;
346 }
347 emitInstructionImpl(Inst, STI);
348}
349
350void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst,
351 const MCSubtargetInfo &STI) {
353
355 Sec->setHasInstructions(true);
356
357 // Now that a machine instruction has been assembled into this section, make
358 // a line entry for any .loc directive that has been seen.
360
361 // If this instruction doesn't need relaxation, just emit it as data.
362 MCAssembler &Assembler = getAssembler();
363 MCAsmBackend &Backend = Assembler.getBackend();
364 if (!(Backend.mayNeedRelaxation(Inst, STI) ||
365 Backend.allowEnhancedRelaxation())) {
366 emitInstToData(Inst, STI);
367 return;
368 }
369
370 // Otherwise, relax and emit it as data if either:
371 // - The RelaxAll flag was passed
372 // - Bundling is enabled and this instruction is inside a bundle-locked
373 // group. We want to emit all such instructions into the same data
374 // fragment.
375 if (Assembler.getRelaxAll() ||
376 (Assembler.isBundlingEnabled() && Sec->isBundleLocked())) {
377 MCInst Relaxed = Inst;
378 while (Backend.mayNeedRelaxation(Relaxed, STI))
379 Backend.relaxInstruction(Relaxed, STI);
380 emitInstToData(Relaxed, STI);
381 return;
382 }
383
384 // Otherwise emit to a separate fragment.
385 emitInstToFragment(Inst, STI);
386}
387
389 const MCSubtargetInfo &STI) {
390 // Always create a new, separate fragment here, because its size can change
391 // during relaxation.
394 insert(IF);
395
396 getAssembler().getEmitter().encodeInstruction(Inst, IF->getContents(),
397 IF->getFixups(), STI);
398}
399
400#ifndef NDEBUG
401static const char *const BundlingNotImplementedMsg =
402 "Aligned bundling is not implemented for this object format";
403#endif
404
407}
408
409void MCObjectStreamer::emitBundleLock(bool AlignToEnd) {
411}
412
415}
416
417void MCObjectStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
418 unsigned Column, unsigned Flags,
419 unsigned Isa,
420 unsigned Discriminator,
421 StringRef FileName) {
422 // In case we see two .loc directives in a row, make sure the
423 // first one gets a line entry.
425
426 this->MCStreamer::emitDwarfLocDirective(FileNo, Line, Column, Flags, Isa,
427 Discriminator, FileName);
428}
429
431 const MCSymbol *B, SMLoc Loc) {
432 MCContext &Context = OS.getContext();
434 const MCExpr *ARef = MCSymbolRefExpr::create(A, Variant, Context);
435 const MCExpr *BRef = MCSymbolRefExpr::create(B, Variant, Context);
436 const MCExpr *AddrDelta =
437 MCBinaryExpr::create(MCBinaryExpr::Sub, ARef, BRef, Context, Loc);
438 return AddrDelta;
439}
440
443 int64_t LineDelta, const MCSymbol *Label,
444 int PointerSize) {
445 // emit the sequence to set the address
446 OS.emitIntValue(dwarf::DW_LNS_extended_op, 1);
447 OS.emitULEB128IntValue(PointerSize + 1);
448 OS.emitIntValue(dwarf::DW_LNE_set_address, 1);
449 OS.emitSymbolValue(Label, PointerSize);
450
451 // emit the sequence for the LineDelta (from 1) and a zero address delta.
452 MCDwarfLineAddr::Emit(&OS, Params, LineDelta, 0);
453}
454
456 const MCSymbol *LastLabel,
457 const MCSymbol *Label,
458 unsigned PointerSize) {
459 if (!LastLabel) {
460 emitDwarfSetLineAddr(*this, Assembler->getDWARFLinetableParams(), LineDelta,
461 Label, PointerSize);
462 return;
463 }
464 const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, SMLoc());
465 insert(getContext().allocFragment<MCDwarfLineAddrFragment>(LineDelta,
466 *AddrDelta));
467}
468
470 MCSymbol *LastLabel) {
471 // Emit a DW_LNE_end_sequence for the end of the section.
472 // Use the section end label to compute the address delta and use INT64_MAX
473 // as the line delta which is the signal that this is actually a
474 // DW_LNE_end_sequence.
475 MCSymbol *SectionEnd = endSection(Section);
476
477 // Switch back the dwarf line section, in case endSection had to switch the
478 // section.
479 MCContext &Ctx = getContext();
481
482 const MCAsmInfo *AsmInfo = Ctx.getAsmInfo();
483 emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, SectionEnd,
484 AsmInfo->getCodePointerSize());
485}
486
488 const MCSymbol *Label,
489 SMLoc Loc) {
490 const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, Loc);
491 insert(getContext().allocFragment<MCDwarfCallFrameFragment>(*AddrDelta));
492}
493
495 unsigned Line, unsigned Column,
496 bool PrologueEnd, bool IsStmt,
497 StringRef FileName, SMLoc Loc) {
498 // Validate the directive.
499 if (!checkCVLocSection(FunctionId, FileNo, Loc))
500 return;
501
502 // Emit a label at the current position and record it in the CodeViewContext.
503 MCSymbol *LineSym = getContext().createTempSymbol();
504 emitLabel(LineSym);
506 FileNo, Line, Column, PrologueEnd,
507 IsStmt);
508}
509
511 const MCSymbol *Begin,
512 const MCSymbol *End) {
514 End);
515 this->MCStreamer::emitCVLinetableDirective(FunctionId, Begin, End);
516}
517
519 unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum,
520 const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) {
522 *this, PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym,
523 FnEndSym);
525 PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym, FnEndSym);
526}
527
529 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
530 StringRef FixedSizePortion) {
531 getContext().getCVContext().emitDefRange(*this, Ranges, FixedSizePortion);
532 // Attach labels that were pending before we created the defrange fragment to
533 // the beginning of the new fragment.
534 this->MCStreamer::emitCVDefRangeDirective(Ranges, FixedSizePortion);
535}
536
539}
542}
543
546}
547
551 DF->getContents().append(Data.begin(), Data.end());
552}
553
555 unsigned ValueSize,
556 unsigned MaxBytesToEmit) {
557 if (MaxBytesToEmit == 0)
558 MaxBytesToEmit = Alignment.value();
559 insert(getContext().allocFragment<MCAlignFragment>(
560 Alignment, Value, ValueSize, MaxBytesToEmit));
561
562 // Update the maximum alignment on the current section if necessary.
564 CurSec->ensureMinAlignment(Alignment);
565}
566
568 const MCSubtargetInfo *STI,
569 unsigned MaxBytesToEmit) {
570 emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit);
571 cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true, STI);
572}
573
575 unsigned char Value,
576 SMLoc Loc) {
577 insert(getContext().allocFragment<MCOrgFragment>(*Offset, Value, Loc));
578}
579
580// Associate DTPRel32 fixup with data and resize data area
583 DF->getFixups().push_back(MCFixup::create(DF->getContents().size(),
585 DF->getContents().resize(DF->getContents().size() + 4, 0);
586}
587
588// Associate DTPRel64 fixup with data and resize data area
591 DF->getFixups().push_back(MCFixup::create(DF->getContents().size(),
593 DF->getContents().resize(DF->getContents().size() + 8, 0);
594}
595
596// Associate TPRel32 fixup with data and resize data area
599 DF->getFixups().push_back(MCFixup::create(DF->getContents().size(),
600 Value, FK_TPRel_4));
601 DF->getContents().resize(DF->getContents().size() + 4, 0);
602}
603
604// Associate TPRel64 fixup with data and resize data area
607 DF->getFixups().push_back(MCFixup::create(DF->getContents().size(),
608 Value, FK_TPRel_8));
609 DF->getContents().resize(DF->getContents().size() + 8, 0);
610}
611
612// Associate GPRel32 fixup with data and resize data area
615 DF->getFixups().push_back(
616 MCFixup::create(DF->getContents().size(), Value, FK_GPRel_4));
617 DF->getContents().resize(DF->getContents().size() + 4, 0);
618}
619
620// Associate GPRel64 fixup with data and resize data area
623 DF->getFixups().push_back(
624 MCFixup::create(DF->getContents().size(), Value, FK_GPRel_4));
625 DF->getContents().resize(DF->getContents().size() + 8, 0);
626}
627
628static std::optional<std::pair<bool, std::string>>
629getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
630 MCDataFragment *&DF) {
631 if (Symbol.isVariable()) {
632 const MCExpr *SymbolExpr = Symbol.getVariableValue();
633 MCValue OffsetVal;
634 if(!SymbolExpr->evaluateAsRelocatable(OffsetVal, nullptr, nullptr))
635 return std::make_pair(false,
636 std::string("symbol in .reloc offset is not "
637 "relocatable"));
638 if (OffsetVal.isAbsolute()) {
639 RelocOffset = OffsetVal.getConstant();
640 MCFragment *Fragment = Symbol.getFragment();
641 // FIXME Support symbols with no DF. For example:
642 // .reloc .data, ENUM_VALUE, <some expr>
643 if (!Fragment || Fragment->getKind() != MCFragment::FT_Data)
644 return std::make_pair(false,
645 std::string("symbol in offset has no data "
646 "fragment"));
647 DF = cast<MCDataFragment>(Fragment);
648 return std::nullopt;
649 }
650
651 if (OffsetVal.getSymB())
652 return std::make_pair(false,
653 std::string(".reloc symbol offset is not "
654 "representable"));
655
656 const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*OffsetVal.getSymA());
657 if (!SRE.getSymbol().isDefined())
658 return std::make_pair(false,
659 std::string("symbol used in the .reloc offset is "
660 "not defined"));
661
662 if (SRE.getSymbol().isVariable())
663 return std::make_pair(false,
664 std::string("symbol used in the .reloc offset is "
665 "variable"));
666
667 MCFragment *Fragment = SRE.getSymbol().getFragment();
668 // FIXME Support symbols with no DF. For example:
669 // .reloc .data, ENUM_VALUE, <some expr>
670 if (!Fragment || Fragment->getKind() != MCFragment::FT_Data)
671 return std::make_pair(false,
672 std::string("symbol in offset has no data "
673 "fragment"));
674 RelocOffset = SRE.getSymbol().getOffset() + OffsetVal.getConstant();
675 DF = cast<MCDataFragment>(Fragment);
676 } else {
677 RelocOffset = Symbol.getOffset();
678 MCFragment *Fragment = Symbol.getFragment();
679 // FIXME Support symbols with no DF. For example:
680 // .reloc .data, ENUM_VALUE, <some expr>
681 if (!Fragment || Fragment->getKind() != MCFragment::FT_Data)
682 return std::make_pair(false,
683 std::string("symbol in offset has no data "
684 "fragment"));
685 DF = cast<MCDataFragment>(Fragment);
686 }
687 return std::nullopt;
688}
689
690std::optional<std::pair<bool, std::string>>
692 const MCExpr *Expr, SMLoc Loc,
693 const MCSubtargetInfo &STI) {
694 std::optional<MCFixupKind> MaybeKind =
695 Assembler->getBackend().getFixupKind(Name);
696 if (!MaybeKind)
697 return std::make_pair(true, std::string("unknown relocation name"));
698
699 MCFixupKind Kind = *MaybeKind;
700 if (Expr)
701 visitUsedExpr(*Expr);
702 else
703 Expr =
704 MCSymbolRefExpr::create(getContext().createTempSymbol(), getContext());
705
707 MCValue OffsetVal;
708 if (!Offset.evaluateAsRelocatable(OffsetVal, nullptr, nullptr))
709 return std::make_pair(false,
710 std::string(".reloc offset is not relocatable"));
711 if (OffsetVal.isAbsolute()) {
712 if (OffsetVal.getConstant() < 0)
713 return std::make_pair(false, std::string(".reloc offset is negative"));
714 DF->getFixups().push_back(
715 MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
716 return std::nullopt;
717 }
718 if (OffsetVal.getSymB())
719 return std::make_pair(false,
720 std::string(".reloc offset is not representable"));
721
722 const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*OffsetVal.getSymA());
723 const MCSymbol &Symbol = SRE.getSymbol();
724 if (Symbol.isDefined()) {
725 uint32_t SymbolOffset = 0;
726 std::optional<std::pair<bool, std::string>> Error =
727 getOffsetAndDataFragment(Symbol, SymbolOffset, DF);
728
729 if (Error != std::nullopt)
730 return Error;
731
732 DF->getFixups().push_back(
733 MCFixup::create(SymbolOffset + OffsetVal.getConstant(),
734 Expr, Kind, Loc));
735 return std::nullopt;
736 }
737
738 PendingFixups.emplace_back(
739 &SRE.getSymbol(), DF,
740 MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
741 return std::nullopt;
742}
743
744void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
745 SMLoc Loc) {
746 assert(getCurrentSectionOnly() && "need a section");
747 insert(
748 getContext().allocFragment<MCFillFragment>(FillValue, 1, NumBytes, Loc));
749}
750
751void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
752 int64_t Expr, SMLoc Loc) {
753 int64_t IntNumValues;
754 // Do additional checking now if we can resolve the value.
755 if (NumValues.evaluateAsAbsolute(IntNumValues, getAssemblerPtr())) {
756 if (IntNumValues < 0) {
759 "'.fill' directive with negative repeat count has no effect");
760 return;
761 }
762 // Emit now if we can for better errors.
763 int64_t NonZeroSize = Size > 4 ? 4 : Size;
764 Expr &= ~0ULL >> (64 - NonZeroSize * 8);
765 for (uint64_t i = 0, e = IntNumValues; i != e; ++i) {
766 emitIntValue(Expr, NonZeroSize);
767 if (NonZeroSize < Size)
768 emitIntValue(0, Size - NonZeroSize);
769 }
770 return;
771 }
772
773 // Otherwise emit as fragment.
774 assert(getCurrentSectionOnly() && "need a section");
775 insert(
776 getContext().allocFragment<MCFillFragment>(Expr, Size, NumValues, Loc));
777}
778
779void MCObjectStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLength,
780 SMLoc Loc, const MCSubtargetInfo &STI) {
781 assert(getCurrentSectionOnly() && "need a section");
782 insert(getContext().allocFragment<MCNopsFragment>(
783 NumBytes, ControlledNopLength, Loc, STI));
784}
785
787 MCAssembler &Asm = getAssembler();
788 Asm.getWriter().addFileName(Asm, Filename);
789}
790
792 StringRef CompilerVersion,
793 StringRef TimeStamp,
794 StringRef Description) {
796 W.addFileName(getAssembler(), Filename);
797 if (CompilerVersion.size())
798 W.setCompilerVersion(CompilerVersion);
799 // TODO: add TimeStamp and Description to .file symbol table entry
800 // with the integrated assembler.
801}
802
805}
806
809}
810
813
814 // If we are generating dwarf for assembly source files dump out the sections.
815 if (getContext().getGenDwarfForAssembly())
817
818 // Dump out the dwarf file & directory tables and line tables.
819 MCDwarfLineTable::emit(this, getAssembler().getDWARFLinetableParams());
820
821 // Emit pseudo probes for the current module.
823
824 resolvePendingFixups();
826}
basic Basic Alias true
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
dxil DXContainer Global Emitter
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
std::string Name
uint64_t Size
bool End
Definition: ELF_riscv.cpp:480
Symbol * Sym
Definition: ELF_riscv.cpp:479
static const MCExpr * buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A, const MCSymbol *B, SMLoc Loc)
static const char *const BundlingNotImplementedMsg
static std::optional< std::pair< bool, std::string > > getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset, MCDataFragment *&DF)
static void emitDwarfSetLineAddr(MCObjectStreamer &OS, MCDwarfLineTableParams Params, int64_t LineDelta, const MCSymbol *Label, int PointerSize)
static std::optional< uint64_t > absoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo)
static bool canReuseDataFragment(const MCDataFragment &F, const MCAssembler &Assembler, const MCSubtargetInfo *STI)
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
bool Debug
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)
Emits a line table substream.
Definition: MCCodeView.cpp:347
void emitFileChecksums(MCObjectStreamer &OS)
Emits the file checksum substream.
Definition: MCCodeView.cpp:190
void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt)
Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.
Definition: MCCodeView.cpp:128
void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo)
Emits the offset into the checksum table of the given file number.
Definition: MCCodeView.cpp:245
void emitInlineLineTableForFunction(MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
Definition: MCCodeView.cpp:442
void emitStringTable(MCObjectStreamer &OS)
Emits the string table substream.
Definition: MCCodeView.cpp:168
MCFragment * emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
Definition: MCCodeView.cpp:455
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
virtual bool allowEnhancedRelaxation() const
Return true if this target allows an unrelaxable instruction to be emitted into RelaxableFragment and...
Definition: MCAsmBackend.h:64
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
Definition: MCAsmBackend.h:179
virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const
Check whether the given instruction may need relaxation.
Definition: MCAsmBackend.h:155
virtual std::optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:546
void Finish()
Finish - Do final processing and write the object to the output stream.
bool isBundlingEnabled() const
Definition: MCAssembler.h:208
MCObjectWriter & getWriter() const
Definition: MCAssembler.h:192
bool getRelaxAll() const
Definition: MCAssembler.h:205
MCCodeEmitter & getEmitter() const
Definition: MCAssembler.h:190
MCAsmBackend & getBackend() const
Definition: MCAssembler.h:188
bool registerSection(MCSection &Section)
bool registerSymbol(const MCSymbol &Symbol)
MCDwarfLineTableParams getDWARFLinetableParams() const
Definition: MCAssembler.h:194
static const MCBinaryExpr * create(Opcode Op, const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition: MCExpr.cpp:182
@ Sub
Subtraction.
Definition: MCExpr.h:513
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
Context object for machine code objects.
Definition: MCContext.h:83
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:416
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Definition: MCContext.cpp:346
void RemapDebugPaths()
Definition: MCContext.cpp:903
void clearDwarfLocSeen()
Definition: MCContext.h:755
CodeViewContext & getCVContext()
Definition: MCContext.cpp:1013
const SourceMgr * getSourceManager() const
Definition: MCContext.h:401
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:412
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:1068
const MCTargetOptions * getTargetOptions() const
Definition: MCContext.h:420
F * allocFragment(Args &&...args)
Definition: MCContext.h:440
Fragment for data and encoded instructions.
Definition: MCFragment.h:219
static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH)
Definition: MCDwarf.cpp:1831
static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)
Utility function to emit the encoding to a streamer.
Definition: MCDwarf.cpp:674
static void make(MCStreamer *MCOS, MCSection *Section)
Definition: MCDwarf.cpp:95
static void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params)
Definition: MCDwarf.cpp:260
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Definition: MCExpr.cpp:788
static MCFixupKind getKindForSize(unsigned Size, bool IsPCRel)
Return the generic fixup kind for a value with the given size.
Definition: MCFixup.h:109
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Definition: MCFixup.h:87
FragmentType getKind() const
Definition: MCFragment.h:97
static void Emit(MCStreamer *MCOS)
Definition: MCDwarf.cpp:1143
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
SMLoc getLoc() const
Definition: MCInst.h:204
MCSection * getDwarfLineSection() const
Streaming object file generation interface.
void reset() override
state management
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
void emitDwarfLineEndEntry(MCSection *Section, MCSymbol *LastLabel) override
Emit the debug line end entry.
void emitValueToAlignment(Align Alignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
void emitULEB128Value(const MCExpr *Value) override
void emitSLEB128Value(const MCExpr *Value) override
void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI) override
MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)
Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) override
This implements the CodeView '.cv_inline_linetable' assembler directive.
void emitCVStringTableDirective() override
This implements the CodeView '.cv_stringtable' assembler directive.
void emitBundleAlignMode(Align Alignment) override
Set the bundle alignment mode from now on in the section.
MCAssembler & getAssembler()
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel, const MCSymbol *Label, unsigned PointerSize) override
If targets does not support representing debug line section by .loc/.file directives in assembly outp...
void emitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc) override
This implements the CodeView '.cv_loc' assembler directive.
void emitDTPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void emitBundleLock(bool AlignToEnd) override
The following instructions are a bundle-locked group.
void emitPendingAssignments(MCSymbol *Symbol)
Emits pending conditional assignments that depend on Symbol being emitted.
bool changeSectionImpl(MCSection *Section, uint32_t Subsection)
void emitFileDirective(StringRef Filename) override
Switch to a new logical file.
void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion) override
This implements the CodeView '.cv_def_range' assembler directive.
void emitGPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
MCAssembler * getAssemblerPtr() override
std::optional< std::pair< bool, std::string > > emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI) override
Record a relocation described by the .reloc directive.
void emitAddrsigSym(const MCSymbol *Sym) override
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void visitUsedSymbol(const MCSymbol &Sym) override
void emitGPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
void insert(MCFragment *F)
virtual void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &)
Emit an instruction to a special fragment, because this instruction can change its size during relaxa...
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
MCObjectStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
void finishImpl() override
Streamer specific finalization.
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) override
Emit the absolute difference between two symbols encoded with ULEB128.
void emitBundleUnlock() override
Ends a bundle-locked group.
void emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, const MCSymbol *Label, SMLoc Loc)
void switchSectionNoPrint(MCSection *Section) override
Similar to switchSection, but does not print the section directive.
void emitCFISections(bool EH, bool Debug) override
void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName) override
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
bool mayHaveInstructions(MCSection &Sec) const override
void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override
Emit nops until the byte alignment ByteAlignment is reached.
void emitFrames(MCAsmBackend *MAB)
void emitTPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a tprel (64-bit TP relative) value.
void emitCVFileChecksumOffsetDirective(unsigned FileNo) override
This implements the CodeView '.cv_filechecksumoffset' assembler directive.
void emitTPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a tprel (32-bit TP relative) value.
void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol, but only if Value is also emitted.
void emitCVFileChecksumsDirective() override
This implements the CodeView '.cv_filechecksums' assembler directive.
void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *Begin, const MCSymbol *End) override
This implements the CodeView '.cv_linetable' assembler directive.
void emitDTPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset)
void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc) override
Emit some number of copies of Value until the byte offset Offset is reached.
void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override
Emit the absolute difference between two symbols if possible.
Defines the object file and target independent interfaces used by the assembler backend to write nati...
void emitAddrsigSection()
Tell the object writer to emit an address-significance table during writeObject().
void addAddrsigSymbol(const MCSymbol *Sym)
Record the given symbol in the address-significance table to be written diring writeObject().
static void emit(MCObjectStreamer *MCOS)
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:234
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:36
virtual StringRef getVirtualSectionKind() const
Definition: MCSection.cpp:69
void ensureMinAlignment(Align MinAlignment)
Makes sure that Alignment is at least MinAlignment.
Definition: MCSection.h:150
bool hasInstructions() const
Definition: MCSection.h:169
void setHasInstructions(bool Value)
Definition: MCSection.h:170
bool isVirtualSection() const
Check whether this section is "virtual", that is has no actual object file contents.
Definition: MCSection.h:198
bool isBundleLocked() const
Definition: MCSection.h:160
StringRef getName() const
Definition: MCSection.h:130
Streaming machine code generation interface.
Definition: MCStreamer.h:213
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual void switchSectionNoPrint(MCSection *Section)
Similar to switchSection, but does not print the section directive.
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
MCFragment * getCurrentFragment() const
Definition: MCStreamer.h:409
virtual void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
Definition: MCStreamer.cpp:262
virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo)
Emit the absolute difference between two symbols encoded with ULEB128.
bool getUseAssemblerInfoForParsing()
Definition: MCStreamer.h:307
MCContext & getContext() const
Definition: MCStreamer.h:300
bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc)
Returns true if the .cv_loc directive is in the right section.
Definition: MCStreamer.cpp:324
virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)
Emit the absolute difference between two symbols.
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:414
void setAllowAutoPadding(bool v)
Definition: MCStreamer.h:313
virtual void reset()
State management.
Definition: MCStreamer.cpp:101
virtual void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView '.cv_linetable' assembler directive.
Definition: MCStreamer.cpp:346
virtual void emitCFISections(bool EH, bool Debug)
Definition: MCStreamer.cpp:436
MCFragment * CurFrag
Definition: MCStreamer.h:255
virtual void emitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.
Definition: MCStreamer.cpp:133
unsigned getNumFrameInfos()
Definition: MCStreamer.cpp:115
unsigned emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:161
MCSymbol * endSection(MCSection *Section)
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
virtual void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
This implements the CodeView '.cv_def_range' assembler directive.
Definition: MCStreamer.cpp:368
MCSection * getCurrentSectionOnly() const
Definition: MCStreamer.h:398
virtual void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Emit the expression Value into the output as a native integer of the given Size bytes.
unsigned emitSLEB128IntValue(int64_t Value)
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:171
virtual void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
This implements the CodeView '.cv_inline_linetable' assembler directive.
Definition: MCStreamer.cpp:350
void visitUsedExpr(const MCExpr &Expr)
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:188
const MCSymbol & getSymbol() const
Definition: MCExpr.h:406
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:393
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Definition: MCSymbol.h:250
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition: MCSymbol.h:300
uint64_t getOffset() const
Definition: MCSymbol.h:327
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:397
This represents an "assembler immediate".
Definition: MCValue.h:36
int64_t getConstant() const
Definition: MCValue.h:43
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:45
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:44
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
Definition: MCValue.h:49
Represents a location in source code.
Definition: SMLoc.h:23
void PrintMessage(raw_ostream &OS, SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges={}, ArrayRef< SMFixIt > FixIts={}, bool ShowColors=true) const
Emit a message about the specified location with the specified string.
Definition: SourceMgr.cpp:352
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
LLVM Value Representation.
Definition: Value.h:74
This class represents a function that is read from a sample profile.
Definition: FunctionId.h:36
#define INT64_MAX
Definition: DataTypes.h:71
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:255
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:167
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
@ FK_DTPRel_4
A four-byte dtp relative fixup.
Definition: MCFixup.h:36
@ FK_DTPRel_8
A eight-byte dtp relative fixup.
Definition: MCFixup.h:37
@ FK_TPRel_4
A four-byte tp relative fixup.
Definition: MCFixup.h:38
@ FK_GPRel_4
A four-byte gp relative fixup.
Definition: MCFixup.h:34
@ FK_TPRel_8
A eight-byte tp relative fixup.
Definition: MCFixup.h:39
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:260
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1849
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
MCSymbol * Begin
Definition: MCDwarf.h:731