60#define DEBUG_TYPE "elf-object-writer"
65STATISTIC(ELFHeaderBytes,
"Total size of ELF headers");
66STATISTIC(SectionHeaderBytes,
"Total size of section headers table");
67STATISTIC(AllocTextBytes,
"Total size of SHF_ALLOC text sections");
68STATISTIC(AllocROBytes,
"Total size of SHF_ALLOC readonly sections");
69STATISTIC(AllocRWBytes,
"Total size of SHF_ALLOC read-write sections");
70STATISTIC(StrtabBytes,
"Total size of SHT_STRTAB sections");
71STATISTIC(SymtabBytes,
"Total size of SHT_SYMTAB sections");
72STATISTIC(RelocationBytes,
"Total size of relocation sections");
73STATISTIC(DynsymBytes,
"Total size of SHT_DYNSYM sections");
76 "Total size of debug info sections (not including those written to .dwo)");
77STATISTIC(UnwindBytes,
"Total size of unwind sections");
78STATISTIC(OtherBytes,
"Total size of uncategorized sections");
79STATISTIC(DwoBytes,
"Total size of sections written to .dwo file");
89class SymbolTableWriter {
94 std::vector<uint32_t> ShndxIndexes;
99 void createSymtabShndx();
104 SymbolTableWriter(ELFWriter &EWriter,
bool Is64Bit);
124 bool Used,
bool Renamed);
127 struct ELFSymbolData {
143 unsigned LastLocalSymbolIndex = ~0
u;
145 unsigned StringTableIndex = ~0
u;
147 unsigned SymbolTableIndex = ~0
u;
150 std::vector<MCSectionELF *> SectionTable;
164 bool IsLittleEndian, DwoMode Mode)
176 template <
typename T>
void write(
T Val) {
182 void writeSymbol(
const MCAssembler &Asm, SymbolTableWriter &Writer,
183 uint32_t StringIndex, ELFSymbolData &MSD);
192 void computeSymbolTable(
MCAssembler &Asm,
const RevGroupMapTy &RevGroupMap);
194 void writeAddrsigSection();
219 W.OS.write_zeros(NewOffset -
Offset);
223unsigned ELFWriter::addToSectionTable(
MCSectionELF *Sec) {
224 SectionTable.push_back(Sec);
225 StrTabBuilder.add(Sec->
getName());
226 return SectionTable.size();
229void SymbolTableWriter::createSymtabShndx() {
230 if (!ShndxIndexes.empty())
233 ShndxIndexes.resize(NumWritten);
236template <
typename T>
void SymbolTableWriter::write(
T Value) {
237 EWriter.write(
Value);
240SymbolTableWriter::SymbolTableWriter(ELFWriter &EWriter,
bool Is64Bit)
241 : EWriter(EWriter), Is64Bit(Is64Bit), NumWritten(0) {}
251 if (!ShndxIndexes.empty()) {
253 ShndxIndexes.push_back(shndx);
255 ShndxIndexes.push_back(0);
279bool ELFWriter::is64Bit()
const {
284void ELFWriter::writeHeader(
const MCAssembler &Asm) {
347 return Sym.getCommonAlignment()->value();
350 if (!
Asm.getSymbolOffset(
Sym, Res))
353 if (
Asm.isThumbFunc(&
Sym))
397 if (!Symbol->isVariable() ||
398 !(
Value = dyn_cast<MCSymbolRefExpr>(Symbol->getVariableValue())) ||
402 Symbol = &cast<MCSymbolELF>(
Value->getSymbol());
407void ELFWriter::writeSymbol(
const MCAssembler &Asm, SymbolTableWriter &Writer,
408 uint32_t StringIndex, ELFSymbolData &MSD) {
409 const auto &
Symbol = cast<MCSymbolELF>(*MSD.Symbol);
411 cast_or_null<MCSymbolELF>(
Asm.getBaseSymbol(Symbol));
435 const MCExpr *ESize = MSD.Symbol->getSize();
436 if (!ESize &&
Base) {
438 ESize =
Base->getSize();
445 while (
Sym->isVariable()) {
447 dyn_cast<MCSymbolRefExpr>(
Sym->getVariableValue(
false))) {
448 Sym = cast<MCSymbolELF>(&Expr->getSymbol());
451 ESize =
Sym->getSize();
465 Writer.writeSymbol(StringIndex, Info,
Value,
Size,
Other, MSD.SectionIndex,
470 bool Used,
bool Renamed) {
471 if (
Symbol.isVariable()) {
474 if (
const auto *
T = dyn_cast<MCTargetExpr>(Expr))
475 if (
T->inlineAssignedExpr())
491 Asm.getBaseSymbol(Symbol);
504void ELFWriter::computeSymbolTable(
MCAssembler &Asm,
505 const RevGroupMapTy &RevGroupMap) {
507 SymbolTableWriter Writer(*
this,
is64Bit());
514 SymbolTableIndex = addToSectionTable(SymtabSection);
519 Writer.writeSymbol(0, 0, 0, 0, 0, 0,
false);
521 std::vector<ELFSymbolData> LocalSymbolData;
522 std::vector<ELFSymbolData> ExternalSymbolData;
525 for (
const std::pair<std::string, size_t> &
F : FileNames)
526 StrTabBuilder.add(
F.first);
529 bool HasLargeSectionIndex =
false;
531 const auto &
Symbol = cast<MCSymbolELF>(It.value());
533 bool WeakrefUsed =
Symbol.isWeakrefUsedInReloc();
534 bool isSignature =
Symbol.isSignature();
536 if (!
isInSymtab(Asm, Symbol, Used || WeakrefUsed || isSignature,
537 OWriter.
Renames.count(&Symbol)))
546 MSD.Symbol = cast<MCSymbolELF>(&Symbol);
547 MSD.Order = It.index();
552 if (
Symbol.isAbsolute()) {
554 }
else if (
Symbol.isCommon()) {
555 if (
Symbol.isTargetCommon()) {
556 MSD.SectionIndex =
Symbol.getIndex();
561 }
else if (
Symbol.isUndefined()) {
562 if (isSignature && !Used) {
563 MSD.SectionIndex = RevGroupMap.lookup(&Symbol);
565 HasLargeSectionIndex =
true;
582 "Undefined section reference: " +
Symbol.getName());
588 MSD.SectionIndex =
Section.getOrdinal();
589 assert(MSD.SectionIndex &&
"Invalid section index!");
591 HasLargeSectionIndex =
true;
605 StrTabBuilder.add(
Name);
609 LocalSymbolData.push_back(MSD);
611 ExternalSymbolData.push_back(MSD);
615 unsigned SymtabShndxSectionIndex = 0;
617 if (HasLargeSectionIndex) {
620 SymtabShndxSectionIndex = addToSectionTable(SymtabShndxSection);
624 StrTabBuilder.finalize();
628 auto FileNameIt = FileNames.begin();
629 if (!FileNames.empty())
630 FileNames[0].second = 0;
632 for (ELFSymbolData &MSD : LocalSymbolData) {
634 for (; FileNameIt != FileNames.end() && FileNameIt->second <= MSD.Order;
636 Writer.writeSymbol(StrTabBuilder.getOffset(FileNameIt->first),
644 : StrTabBuilder.getOffset(MSD.Name);
645 MSD.Symbol->setIndex(Index++);
646 writeSymbol(Asm, Writer, StringIndex, MSD);
648 for (; FileNameIt != FileNames.end(); ++FileNameIt) {
649 Writer.writeSymbol(StrTabBuilder.getOffset(FileNameIt->first),
656 LastLocalSymbolIndex =
Index;
658 for (ELFSymbolData &MSD : ExternalSymbolData) {
659 unsigned StringIndex = StrTabBuilder.getOffset(MSD.Name);
660 MSD.Symbol->setIndex(Index++);
661 writeSymbol(Asm, Writer, StringIndex, MSD);
669 if (ShndxIndexes.
empty()) {
670 assert(SymtabShndxSectionIndex == 0);
673 assert(SymtabShndxSectionIndex != 0);
675 SecStart =
W.OS.tell();
676 MCSectionELF *SymtabShndxSection = SectionTable[SymtabShndxSectionIndex - 1];
679 SecEnd =
W.OS.tell();
680 SymtabShndxSection->
setOffsets(SecStart, SecEnd);
683void ELFWriter::writeAddrsigSection() {
685 if (
Sym->getIndex() != 0)
700 if (TO && TO->
Crel) {
707 const bool Rela = OWriter.
usesRela(TO, Sec);
723bool ELFWriter::maybeWriteCompression(
728 if (
Size <= HdrSize + CompressedContents.
size())
749 auto &Ctx =
Asm.getContext();
752 : DebugCompressionType::None;
753 if (CompressionType == DebugCompressionType::None ||
755 Asm.writeSectionData(
W.OS, &Section);
761 Asm.writeSectionData(VecOS, &Section);
764 UncompressedData.
size());
768 switch (CompressionType) {
769 case DebugCompressionType::None:
771 case DebugCompressionType::Zlib:
774 case DebugCompressionType::Zstd:
780 if (!maybeWriteCompression(ChType, UncompressedData.
size(), Compressed,
782 W.OS << UncompressedData;
807 writeWord(Alignment ? Alignment->value() : 0);
808 writeWord(EntrySize);
813 using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
815 uint32_t SymIdx = R.Symbol ? R.Symbol->getIndex() : 0;
817 std::make_signed_t<uint>(R.Addend)};
821void ELFWriter::writeRelocations(
const MCAssembler &Asm,
823 std::vector<ELFRelocationEntry> &Relocs = OWriter.
Relocations[&Sec];
825 const bool Rela = OWriter.
usesRela(TO, Sec);
865 }
else if (TO && TO->
Crel) {
867 encodeCrel<true>(Relocs,
W.OS);
869 encodeCrel<false>(Relocs,
W.OS);
908 sh_link = SymbolTableIndex;
909 assert(sh_link &&
".symtab not found");
916 sh_link = StringTableIndex;
917 sh_info = LastLocalSymbolIndex;
923 sh_link = SymbolTableIndex;
927 sh_link = SymbolTableIndex;
928 sh_info = GroupSymbolIndex;
936 if (
Sym &&
Sym->isInSection())
937 sh_link =
Sym->getSection().getOrdinal();
940 writeSectionHeaderEntry(StrTabBuilder.getOffset(
Section.getName()),
946void ELFWriter::writeSectionHeaders(
const MCAssembler &Asm) {
948 const unsigned NumSections = SectionTable.size();
953 writeSectionHeaderEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, std::nullopt,
960 GroupSymbolIndex = 0;
962 GroupSymbolIndex =
Section->getGroup()->getIndex();
967 Size =
Asm.getSectionAddressSize(*Section);
975 if (Mode == DwoOnly) {
976 stats::DwoBytes +=
Size;
977 }
else if (
Section->getName().starts_with(
".debug")) {
978 stats::DebugBytes +=
Size;
979 }
else if (
Section->getName().starts_with(
".eh_frame")) {
980 stats::UnwindBytes +=
Size;
983 stats::AllocTextBytes +=
Size;
985 stats::AllocRWBytes +=
Size;
987 stats::AllocROBytes +=
Size;
992 stats::StrtabBytes +=
Size;
995 stats::SymtabBytes +=
Size;
998 stats::DynsymBytes +=
Size;
1003 stats::RelocationBytes +=
Size;
1006 stats::OtherBytes +=
Size;
1011 writeSectionHeader(GroupSymbolIndex,
Offsets.first,
Size, *Section);
1014 stats::SectionHeaderBytes +=
W.OS.tell() - Start;
1023 StringTableIndex = addToSectionTable(StrtabSection);
1025 RevGroupMapTy RevGroupMap;
1030 stats::ELFHeaderBytes +=
W.OS.tell() - StartOffset;
1048 writeSectionData(Asm, Section);
1051 Section.setOffsets(SecStart, SecEnd);
1053 MCSectionELF *RelSection = createRelocationSection(Ctx, Section);
1055 unsigned *GroupIdxEntry =
nullptr;
1056 if (SignatureSymbol) {
1057 GroupIdxEntry = &RevGroupMap[SignatureSymbol];
1058 if (!*GroupIdxEntry) {
1061 *GroupIdxEntry = addToSectionTable(Group);
1064 GroupMap.
resize(*GroupIdxEntry + 1);
1065 GroupMap[*GroupIdxEntry] =
Groups.size();
1070 Section.setOrdinal(addToSectionTable(&Section));
1072 RelSection->
setOrdinal(addToSectionTable(RelSection));
1076 if (GroupIdxEntry) {
1077 auto &Members =
Groups[GroupMap[*GroupIdxEntry]];
1078 Members.second.push_back(
Section.getOrdinal());
1080 Members.second.push_back(RelSection->
getOrdinal());
1084 for (
auto &[Group, Members] :
Groups) {
1089 W.write<
unsigned>(Members);
1095 if (Mode == DwoOnly) {
1098 StrTabBuilder.finalize();
1104 addToSectionTable(AddrsigSection);
1108 computeSymbolTable(Asm, RevGroupMap);
1114 writeRelocations(Asm,
1123 writeAddrsigSection();
1125 AddrsigSection->
setOffsets(SecStart, SecEnd);
1131 StrTabBuilder.write(
W.OS);
1138 writeSectionHeaders(Asm);
1140 uint16_t NumSections = support::endian::byte_swap<uint16_t>(
1142 : SectionTable.size() + 1,
1144 unsigned NumSectionsOffset;
1149 support::endian::byte_swap<uint64_t>(SectionHeaderOffset,
W.Endian);
1150 Stream.pwrite(
reinterpret_cast<char *
>(&Val),
sizeof(Val),
1155 support::endian::byte_swap<uint32_t>(SectionHeaderOffset,
W.Endian);
1156 Stream.pwrite(
reinterpret_cast<char *
>(&Val),
sizeof(Val),
1160 Stream.pwrite(
reinterpret_cast<char *
>(&NumSections),
sizeof(NumSections),
1163 return W.OS.tell() - StartOffset;
1169 IsLittleEndian(IsLittleEndian) {}
1173 : TargetObjectWriter(
std::
move(MOTW)),
OS(
OS), DwoOS(&DwoOS),
1174 IsLittleEndian(IsLittleEndian) {}
1177 ELFHeaderEFlags = 0;
1195 const auto &Symbol = cast<MCSymbolELF>(*S.Sym);
1196 size_t Pos = AliasName.
find(
'@');
1203 Tail = Rest.
substr(Symbol.isUndefined() ? 2 : 1);
1206 cast<MCSymbolELF>(Asm.getContext().getOrCreateSymbol(Prefix +
Tail));
1207 Asm.registerSymbol(*Alias);
1209 Alias->setVariableValue(
Value);
1213 Alias->setBinding(Symbol.getBinding());
1214 Alias->setVisibility(Symbol.getVisibility());
1215 Alias->setOther(Symbol.getOther());
1217 if (!Symbol.isUndefined() && S.KeepOriginalSym)
1220 if (Symbol.isUndefined() && Rest.
starts_with(
"@@") &&
1222 Asm.getContext().reportError(S.Loc,
"default version symbol " +
1223 AliasName +
" must be defined");
1227 if (
auto It =
Renames.find(&Symbol);
1228 It !=
Renames.end() && It->second != Alias) {
1229 Asm.getContext().reportError(S.Loc,
Twine(
"multiple versions for ") +
1234 Renames.insert(std::make_pair(&Symbol, Alias));
1240 if (
Sym->isInSection() &&
Sym->getName().starts_with(
".L"))
1241 Sym =
Sym->getSection().getBeginSymbol();
1242 Sym->setUsedInReloc();
1253 unsigned Type)
const {
1290 if (
Sym->isUndefined())
1299 if (
Sym->isMemtag())
1302 unsigned Binding =
Sym->getBinding();
1333 if (
Sym->isInSection()) {
1334 auto &Sec = cast<MCSectionELF>(
Sym->getSection());
1343 Type == ELF::R_386_GOTOFF)
1370 if (Asm.isThumbFunc(
Sym))
1383 Ctx.
reportError(Loc,
"A dwo section may not contain relocations");
1387 Ctx.
reportError(Loc,
"A relocation may not refer to a dwo section");
1403 uint64_t FixupOffset = Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
1408 const auto &SymB = cast<MCSymbolELF>(RefB->getSymbol());
1409 if (SymB.isUndefined()) {
1411 Twine(
"symbol '") + SymB.getName() +
1412 "' can not be undefined in a subtraction expression");
1416 assert(!SymB.isAbsolute() &&
"Should have been folded");
1417 const MCSection &SecB = SymB.getSection();
1418 if (&SecB != &FixupSection) {
1420 "Cannot represent a difference across sections");
1424 assert(!IsPCRel &&
"should have been folded");
1426 C += FixupOffset - Asm.getSymbolOffset(SymB);
1431 const auto *SymA = RefA ? cast<MCSymbolELF>(&RefA->
getSymbol()) :
nullptr;
1433 bool ViaWeakRef =
false;
1434 if (SymA && SymA->isVariable()) {
1435 const MCExpr *Expr = SymA->getVariableValue();
1436 if (
const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr)) {
1438 SymA = cast<MCSymbolELF>(&Inner->getSymbol());
1444 const MCSectionELF *SecA = (SymA && SymA->isInSection())
1445 ? cast<MCSectionELF>(&SymA->getSection())
1451 const auto *Parent = cast<MCSectionELF>(Fragment->
getParent());
1453 bool RelocateWithSymbol =
1456 uint64_t Addend = !RelocateWithSymbol && SymA && !SymA->isUndefined()
1457 ?
C + Asm.getSymbolOffset(*SymA)
1459 FixedValue =
usesRela(TO, FixupSection) ? 0 : Addend;
1461 if (!RelocateWithSymbol) {
1462 const auto *SectionSymbol =
1465 SectionSymbol->setUsedInReloc();
1494 bool InSet,
bool IsPCRel)
const {
1495 const auto &SymA = cast<MCSymbolELF>(SA);
1502 return &SymA.getSection() == FB.
getParent();
1508 DwoOS ? ELFWriter::NonDwoOnly : ELFWriter::AllSections)
#define offsetof(TYPE, MEMBER)
BlockVerifier::State From
Analysis containing CSE Info
Given that RA is a live value
This file defines the DenseMap class.
static uint8_t mergeTypeForSet(uint8_t origType, uint8_t newType)
static void encodeCrel(ArrayRef< ELFRelocationEntry > Relocs, raw_ostream &OS)
static bool isIFunc(const MCSymbolELF *Symbol)
std::optional< std::vector< StOtherPiece > > Other
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
static SymbolRef::Type getType(const Symbol *Sym)
static bool isInSymtab(const MCSymbolWasm &Sym)
static bool isDwoSection(const MCSection &Sec)
static bool is64Bit(const char *name)
static const X86InstrFMA3Group Groups[]
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
std::unique_ptr< MCELFObjectTargetWriter > TargetObjectWriter
ELFObjectWriter(std::unique_ptr< MCELFObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
unsigned getELFHeaderEFlags() const
bool shouldRelocateWithSymbol(const MCAssembler &Asm, const MCValue &Val, const MCSymbolELF *Sym, uint64_t C, unsigned Type) const
uint64_t writeObject(MCAssembler &Asm) override
Write the object file and returns the number of bytes written.
void executePostLayoutBinding(MCAssembler &Asm) override
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
void reset() override
lifetime management
std::optional< uint8_t > OverrideABIVersion
void recordRelocation(MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) override
Record a relocation entry.
DenseMap< const MCSectionELF *, std::vector< ELFRelocationEntry > > Relocations
SmallVector< Symver, 0 > Symvers
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB, bool InSet, bool IsPCRel) const override
bool hasRelocationAddend() const
bool checkRelocation(MCContext &Ctx, SMLoc Loc, const MCSectionELF *From, const MCSectionELF *To)
raw_pwrite_stream * DwoOS
bool usesRela(const MCTargetOptions *TO, const MCSectionELF &Sec) const
DenseMap< const MCSymbolELF *, const MCSymbolELF * > Renames
Generic interface to target specific assembler backends.
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
Context object for machine code objects.
MCSectionELF * createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection)
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
void reportError(SMLoc L, const Twine &Msg)
const MCTargetOptions * getTargetOptions() const
MCSectionELF * createELFGroupSection(const MCSymbolELF *Group, bool IsComdat)
Base class for the full range of assembler expressions which are needed for parsing.
bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const
Aggressive variant of evaluateAsRelocatable when relocations are unavailable (e.g.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSection * getParent() const
MutableArrayRef< std::pair< std::string, size_t > > getFileNames()
bool getEmitAddrsigSection()
std::vector< const MCSymbol * > & getAddrsigSyms()
virtual void reset()
lifetime management
std::vector< const MCSymbol * > AddrsigSyms
This represents a section on linux, lots of unix variants and some bare metal systems.
const MCSection * getLinkedToSection() const
unsigned getFlags() const
void setOffsets(uint64_t Start, uint64_t End)
const MCSymbolELF * getGroup() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void setAlignment(Align Value)
unsigned getOrdinal() const
void setOrdinal(unsigned Value)
StringRef getName() const
MCSymbol * getBeginSymbol()
void setIsWeakrefUsedInReloc() const
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
VariantKind getKind() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void setUsedInReloc() const
DebugCompressionType CompressDebugSections
This represents an "assembler immediate".
const MCSymbolRefExpr * getSymA() const
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Represents a location in source code.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
static constexpr size_t npos
Utility for building string tables with deduplicated suffixes.
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
An abstract base class for streams implementations that also support a pwrite operation.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ C
The default llvm calling convention, compatible with C.
static const char ElfMagic[]
@ SHT_LLVM_CALL_GRAPH_PROFILE
Flag
These should be considered private to the implementation of the MCInstrDesc class.
void compress(Params P, ArrayRef< uint8_t > Input, SmallVectorImpl< uint8_t > &Output)
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
support::ulittle32_t Word
This is an optimization pass for GlobalISel generic memory operations.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ Ref
The access may reference the value stored in memory.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
void setSymbolAndType(Elf32_Word s, unsigned char t)
void setSymbolAndType(Elf64_Word s, Elf64_Word t)
@ FKF_IsPCRel
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
unsigned Flags
Flags describing additional information on this fixup kind.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Adapter to write values to a stream in a particular byte order.