54#define DEBUG_TYPE "WinCOFFObjectWriter"
58constexpr int OffsetLabelIntervalBits = 20;
84 COFFSymbol *
Other =
nullptr;
85 COFFSection *Section =
nullptr;
89 COFFSymbol(
StringRef Name) : Name(Name) {}
93 int64_t getIndex()
const {
return Index; }
94 void setIndex(
int Value) {
102struct COFFRelocation {
104 COFFSymbol *Symb =
nullptr;
106 COFFRelocation() =
default;
111using relocations = std::vector<COFFRelocation>;
120 COFFSymbol *Symbol =
nullptr;
121 relocations Relocations;
123 COFFSection(
StringRef Name) : Name(std::string(Name)) {}
132 using symbols = std::vector<std::unique_ptr<COFFSymbol>>;
133 using sections = std::vector<std::unique_ptr<COFFSection>>;
140 std::unique_ptr<MCWinCOFFObjectTargetWriter> TargetObjectWriter;
149 section_map SectionMap;
150 symbol_map SymbolMap;
152 symbol_list WeakDefaults;
155 bool UseOffsetLabels =
false;
161 WinCOFFObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
164 void reset()
override {
165 memset(&Header, 0,
sizeof(Header));
166 Header.Machine = TargetObjectWriter->getMachine();
172 WeakDefaults.clear();
177 COFFSymbol *GetOrCreateCOFFSymbol(
const MCSymbol *Symbol);
182 COFFSymbol *getLinkedSymbol(
const MCSymbol &Symbol);
186 void SetSymbolName(COFFSymbol &S);
187 void SetSectionName(COFFSection &S);
189 bool IsPhysicalSection(COFFSection *S);
194 void WriteSymbol(
const COFFSymbol &S);
196 void writeSectionHeaders();
201 const COFFSection &Sec,
const MCSection &MCSec);
211 bool IsPCRel)
const override;
218 void setWeakDefaultNames();
219 void assignSectionNumbers();
241WinCOFFObjectWriter::WinCOFFObjectWriter(
244 Header.Machine = TargetObjectWriter->getMachine();
252COFFSymbol *WinCOFFObjectWriter::createSymbol(
StringRef Name) {
253 Symbols.push_back(std::make_unique<COFFSymbol>(
Name));
254 return Symbols.back().get();
257COFFSymbol *WinCOFFObjectWriter::GetOrCreateCOFFSymbol(
const MCSymbol *Symbol) {
264COFFSection *WinCOFFObjectWriter::createSection(
StringRef Name) {
265 Sections.emplace_back(std::make_unique<COFFSection>(
Name));
266 return Sections.back().get();
305void WinCOFFObjectWriter::defineSection(
const MCSectionCOFF &MCSec,
316 COFFSymbol *COMDATSymbol = GetOrCreateCOFFSymbol(S);
317 if (COMDATSymbol->Section)
319 COMDATSymbol->Section =
Section;
326 Symbol->Aux[0].AuxType = ATSectionDefinition;
347 Section->OffsetSymbols.push_back(Label);
354 if (Symbol.isCommon() && Symbol.isExternal())
355 return Symbol.getCommonSize();
364COFFSymbol *WinCOFFObjectWriter::getLinkedSymbol(
const MCSymbol &Symbol) {
369 dyn_cast<MCSymbolRefExpr>(
Symbol.getVariableValue());
375 return GetOrCreateCOFFSymbol(&Aliasee);
382void WinCOFFObjectWriter::DefineSymbol(
const MCSymbol &MCSym,
385 COFFSymbol *
Sym = GetOrCreateCOFFSymbol(&MCSym);
387 COFFSection *Sec =
nullptr;
389 Sec = SectionMap[
Base->getFragment()->getParent()];
390 if (
Sym->Section &&
Sym->Section != Sec)
394 COFFSymbol *
Local =
nullptr;
395 if (cast<MCSymbolCOFF>(MCSym).isWeakExternal()) {
397 Sym->Section =
nullptr;
399 COFFSymbol *WeakDefault = getLinkedSymbol(MCSym);
401 std::string WeakName = (
".weak." + MCSym.
getName() +
".default").str();
402 WeakDefault = createSymbol(WeakName);
406 WeakDefault->Section = Sec;
407 WeakDefaults.insert(WeakDefault);
411 Sym->Other = WeakDefault;
415 memset(&
Sym->Aux[0], 0,
sizeof(
Sym->Aux[0]));
416 Sym->Aux[0].AuxType = ATWeakExternal;
417 Sym->Aux[0].Aux.WeakExternal.TagIndex = 0;
418 Sym->Aux[0].Aux.WeakExternal.Characteristics =
431 const MCSymbolCOFF &SymbolCOFF = cast<MCSymbolCOFF>(MCSym);
448void WinCOFFObjectWriter::SetSectionName(COFFSection &S) {
450 std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size());
454 uint64_t StringTableEntry = Strings.getOffset(S.Name);
459void WinCOFFObjectWriter::SetSymbolName(COFFSymbol &S) {
461 S.set_name_offset(Strings.getOffset(S.Name));
463 std::memcpy(S.Data.Name, S.Name.c_str(), S.Name.size());
466bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
474void WinCOFFObjectWriter::WriteFileHeader(
const COFF::header &Header) {
486 W.write<
uint32_t>(Header.NumberOfSections);
487 W.write<
uint32_t>(Header.PointerToSymbolTable);
488 W.write<
uint32_t>(Header.NumberOfSymbols);
491 W.write<
uint16_t>(
static_cast<int16_t
>(Header.NumberOfSections));
493 W.write<
uint32_t>(Header.PointerToSymbolTable);
494 W.write<
uint32_t>(Header.NumberOfSymbols);
495 W.write<
uint16_t>(Header.SizeOfOptionalHeader);
496 W.write<
uint16_t>(Header.Characteristics);
500void WinCOFFObjectWriter::WriteSymbol(
const COFFSymbol &S) {
506 W.write<
uint16_t>(
static_cast<int16_t
>(S.Data.SectionNumber));
508 W.OS <<
char(S.Data.StorageClass);
509 W.OS <<
char(S.Data.NumberOfAuxSymbols);
510 WriteAuxiliarySymbols(S.Aux);
513void WinCOFFObjectWriter::WriteAuxiliarySymbols(
515 for (
const AuxSymbol &i : S) {
518 W.write<
uint32_t>(i.Aux.WeakExternal.TagIndex);
519 W.write<
uint32_t>(i.Aux.WeakExternal.Characteristics);
520 W.OS.write_zeros(
sizeof(i.Aux.WeakExternal.unused));
525 W.OS.write(
reinterpret_cast<const char *
>(&i.Aux),
528 case ATSectionDefinition:
529 W.write<
uint32_t>(i.Aux.SectionDefinition.Length);
530 W.write<
uint16_t>(i.Aux.SectionDefinition.NumberOfRelocations);
531 W.write<
uint16_t>(i.Aux.SectionDefinition.NumberOfLinenumbers);
532 W.write<
uint32_t>(i.Aux.SectionDefinition.CheckSum);
533 W.write<
uint16_t>(
static_cast<int16_t
>(i.Aux.SectionDefinition.Number));
534 W.OS <<
char(i.Aux.SectionDefinition.Selection);
535 W.OS.write_zeros(
sizeof(i.Aux.SectionDefinition.unused));
536 W.write<
uint16_t>(
static_cast<int16_t
>(i.Aux.SectionDefinition.Number >> 16));
545void WinCOFFObjectWriter::writeSectionHeaders() {
549 std::vector<COFFSection *> Arr;
550 for (
auto &Section : Sections)
552 llvm::sort(Arr, [](
const COFFSection *
A,
const COFFSection *
B) {
553 return A->Number <
B->Number;
556 for (
auto &Section : Arr) {
561 if (
Section->Relocations.size() >= 0xffff)
592 Asm.writeSectionData(VecOS, &MCSec, Layout);
604void WinCOFFObjectWriter::writeSection(
MCAssembler &Asm,
606 const COFFSection &Sec,
608 if (Sec.Number == -1)
612 if (Sec.Header.PointerToRawData != 0) {
613 assert(
W.OS.tell() == Sec.Header.PointerToRawData &&
614 "Section::PointerToRawData is insane!");
616 uint32_t CRC = writeSectionContents(Asm, Layout, MCSec);
619 COFFSection *Sec = SectionMap[&MCSec];
621 assert(AuxSyms.
size() == 1 && AuxSyms[0].AuxType == ATSectionDefinition);
622 AuxSymbol &SecDef = AuxSyms[0];
623 SecDef.Aux.SectionDefinition.CheckSum = CRC;
627 if (Sec.Relocations.empty()) {
628 assert(Sec.Header.PointerToRelocations == 0 &&
629 "Section::PointerToRelocations is insane!");
633 assert(
W.OS.tell() == Sec.Header.PointerToRelocations &&
634 "Section::PointerToRelocations is insane!");
636 if (Sec.Relocations.size() >= 0xffff) {
640 R.VirtualAddress = Sec.Relocations.size() + 1;
641 R.SymbolTableIndex = 0;
646 for (
const auto &Relocation : Sec.Relocations)
647 WriteRelocation(Relocation.Data);
653void WinCOFFObjectWriter::executePostLayoutBinding(
MCAssembler &Asm,
655 if (EmitAddrsigSection) {
656 AddrsigSection =
Asm.getContext().getCOFFSection(
659 Asm.registerSection(*AddrsigSection);
662 if (!
Asm.CGProfile.empty()) {
663 CGProfileSection =
Asm.getContext().getCOFFSection(
666 Asm.registerSection(*CGProfileSection);
671 for (
const auto &Section : Asm)
672 defineSection(
static_cast<const MCSectionCOFF &
>(Section), Layout);
675 if (!
Symbol.isTemporary())
676 DefineSymbol(Symbol, Asm, Layout);
679bool WinCOFFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
681 bool InSet,
bool IsPCRel)
const {
695void WinCOFFObjectWriter::recordRelocation(
MCAssembler &Asm,
700 assert(
Target.getSymA() &&
"Relocation must reference a symbol!");
703 if (!
A.isRegistered()) {
704 Asm.getContext().reportError(
Fixup.getLoc(),
705 Twine(
"symbol '") +
A.getName() +
706 "' can not be undefined");
709 if (
A.isTemporary() &&
A.isUndefined()) {
710 Asm.getContext().reportError(
Fixup.getLoc(),
711 Twine(
"assembler label '") +
A.getName() +
712 "' can not be undefined");
719 assert(SectionMap.contains(MCSec) &&
720 "Section must already have been defined in executePostLayoutBinding!");
722 COFFSection *Sec = SectionMap[MCSec];
727 if (!
B->getFragment()) {
728 Asm.getContext().reportError(
730 Twine(
"symbol '") +
B->getName() +
731 "' can not be undefined in a subtraction expression");
739 int64_t OffsetOfRelocation =
742 FixedValue = (OffsetOfRelocation - OffsetOfB) +
Target.getConstant();
744 FixedValue =
Target.getConstant();
747 COFFRelocation Reloc;
749 Reloc.Data.SymbolTableIndex = 0;
753 if (
A.isTemporary()) {
756 SectionMap.contains(TargetSection) &&
757 "Section must already have been defined in executePostLayoutBinding!");
758 COFFSection *
Section = SectionMap[TargetSection];
765 if (UseOffsetLabels && !
Section->OffsetSymbols.empty()) {
766 uint64_t LabelIndex = FixedValue >> OffsetLabelIntervalBits;
767 if (LabelIndex > 0) {
768 if (LabelIndex <= Section->OffsetSymbols.size())
769 Reloc.Symb =
Section->OffsetSymbols[LabelIndex - 1];
771 Reloc.Symb =
Section->OffsetSymbols.back();
772 FixedValue -= Reloc.Symb->Data.Value;
778 "Symbol must already have been defined in executePostLayoutBinding!");
782 ++Reloc.Symb->Relocations;
784 Reloc.Data.VirtualAddress +=
Fixup.getOffset();
785 Reloc.Data.Type = TargetObjectWriter->getRelocType(
801 switch (Reloc.Data.Type) {
833 FixedValue = FixedValue + 4;
842 if (TargetObjectWriter->recordRelocation(
Fixup))
843 Sec->Relocations.push_back(Reloc);
847 std::time_t Now = time(
nullptr);
848 if (Now < 0 || !isUInt<32>(Now))
854void WinCOFFObjectWriter::createFileSymbols(
MCAssembler &Asm) {
855 for (
const std::pair<std::string, size_t> &It :
Asm.getFileNames()) {
857 const std::string &
Name = It.first;
859 unsigned Count = (
Name.size() + SymbolSize - 1) / SymbolSize;
861 COFFSymbol *
File = createSymbol(
".file");
864 File->Aux.resize(Count);
868 for (
auto &Aux :
File->Aux) {
869 Aux.AuxType = ATFile;
871 if (
Length > SymbolSize) {
872 memcpy(&Aux.Aux,
Name.c_str() +
Offset, SymbolSize);
876 memset((
char *)&Aux.Aux +
Length, 0, SymbolSize -
Length);
885void WinCOFFObjectWriter::setWeakDefaultNames() {
886 if (WeakDefaults.empty())
896 COFFSymbol *Unique =
nullptr;
897 for (
bool AllowComdat : {
false,
true}) {
898 for (
auto &
Sym : Symbols) {
900 if (WeakDefaults.count(
Sym.get()))
908 if (!AllowComdat &&
Sym->Section &&
920 for (
auto *
Sym : WeakDefaults) {
921 Sym->Name.append(
".");
922 Sym->Name.append(Unique->Name);
927 return Section.Symbol->Aux[0].Aux.SectionDefinition.Selection ==
931void WinCOFFObjectWriter::assignSectionNumbers() {
935 Section.Symbol->Data.SectionNumber =
I;
936 Section.Symbol->Aux[0].Aux.SectionDefinition.Number =
I;
943 for (
const std::unique_ptr<COFFSection> &Section : Sections)
946 for (
const std::unique_ptr<COFFSection> &Section : Sections)
952void WinCOFFObjectWriter::assignFileOffsets(
MCAssembler &Asm,
959 for (
const auto &Section : Asm) {
960 COFFSection *Sec = SectionMap[&
Section];
962 if (!Sec || Sec->Number == -1)
967 if (IsPhysicalSection(Sec)) {
968 Sec->Header.PointerToRawData =
Offset;
969 Offset += Sec->Header.SizeOfRawData;
972 if (!Sec->Relocations.empty()) {
973 bool RelocationsOverflow = Sec->Relocations.size() >= 0xffff;
975 if (RelocationsOverflow) {
978 Sec->Header.NumberOfRelocations = 0xffff;
980 Sec->Header.NumberOfRelocations = Sec->Relocations.size();
982 Sec->Header.PointerToRelocations =
Offset;
984 if (RelocationsOverflow) {
991 for (
auto &Relocation : Sec->Relocations) {
992 assert(Relocation.Symb->getIndex() != -1);
993 Relocation.Data.SymbolTableIndex = Relocation.Symb->getIndex();
997 assert(Sec->Symbol->Aux.size() == 1 &&
998 "Section's symbol must have one aux!");
999 AuxSymbol &Aux = Sec->Symbol->Aux[0];
1000 assert(Aux.AuxType == ATSectionDefinition &&
1001 "Section's symbol's aux symbol must be a Section Definition!");
1002 Aux.Aux.SectionDefinition.Length = Sec->Header.SizeOfRawData;
1003 Aux.Aux.SectionDefinition.NumberOfRelocations =
1004 Sec->Header.NumberOfRelocations;
1005 Aux.Aux.SectionDefinition.NumberOfLinenumbers =
1006 Sec->Header.NumberOfLineNumbers;
1009 Header.PointerToSymbolTable =
Offset;
1016 if (Sections.size() > INT32_MAX)
1018 "PE COFF object files can't have more than 2147483647 sections");
1021 Header.NumberOfSections = Sections.size();
1022 Header.NumberOfSymbols = 0;
1024 setWeakDefaultNames();
1025 assignSectionNumbers();
1026 createFileSymbols(Asm);
1028 for (
auto &Symbol : Symbols) {
1032 Symbol->setIndex(Header.NumberOfSymbols++);
1035 Header.NumberOfSymbols +=
Symbol->Data.NumberOfAuxSymbols;
1039 for (
const auto &S : Sections)
1041 Strings.add(S->
Name);
1042 for (
const auto &S : Symbols)
1044 Strings.add(S->
Name);
1048 for (
const auto &S : Sections)
1050 for (
auto &S : Symbols)
1054 for (
auto &Symbol : Symbols) {
1057 assert(
Symbol->Aux.size() == 1 &&
"Symbol must contain one aux symbol!");
1059 "Symbol's aux symbol must be a Weak External!");
1060 Symbol->Aux[0].Aux.WeakExternal.TagIndex =
Symbol->Other->getIndex();
1065 for (
auto &Section : Sections) {
1066 if (
Section->Symbol->Aux[0].Aux.SectionDefinition.Selection !=
1077 Asm.getContext().reportError(
1079 Twine(
" associative with sectionless symbol ") +
1084 const auto *AssocMCSec = cast<MCSectionCOFF>(&AssocMCSym->
getSection());
1085 assert(SectionMap.count(AssocMCSec));
1086 COFFSection *AssocSec = SectionMap[AssocMCSec];
1089 if (AssocSec->Number == -1)
1092 Section->Symbol->Aux[0].Aux.SectionDefinition.Number = AssocSec->Number;
1096 if (EmitAddrsigSection) {
1098 Frag->setLayoutOrder(0);
1100 for (
const MCSymbol *S : AddrsigSyms) {
1101 if (!S->isRegistered())
1103 if (!S->isTemporary()) {
1108 MCSection *TargetSection = &S->getSection();
1109 assert(SectionMap.contains(TargetSection) &&
1110 "Section must already have been defined in "
1111 "executePostLayoutBinding!");
1117 if (CGProfileSection) {
1119 Frag->setLayoutOrder(0);
1130 assignFileOffsets(Asm, Layout);
1134 if (
Asm.isIncrementalLinkerCompatible()) {
1135 Header.TimeDateStamp =
getTime();
1138 Header.TimeDateStamp = 0;
1142 WriteFileHeader(Header);
1143 writeSectionHeaders();
1146 sections::iterator
I = Sections.begin();
1147 sections::iterator
IE = Sections.end();
1150 for (;
I !=
IE && J != JE; ++
I, ++J)
1151 writeSection(Asm, Layout, **
I, *J);
1153 assert(
W.OS.tell() == Header.PointerToSymbolTable &&
1154 "Header::PointerToSymbolTable is insane!");
1157 for (
auto &Symbol : Symbols)
1158 if (
Symbol->getIndex() != -1)
1159 WriteSymbol(*Symbol);
1162 Strings.write(
W.OS);
1164 return W.OS.tell() - StartOffset;
1168 : Machine(Machine_) {}
1171void MCWinCOFFObjectTargetWriter::anchor() {}
1178 return std::make_unique<WinCOFFObjectWriter>(std::move(MOTW),
OS);
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
COFFYAML::AuxSymbolType AuxType
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
std::optional< std::vector< StOtherPiece > > Other
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
static uint32_t getAlignment(const MCSectionCOFF &Sec)
static bool isAssociative(const COFFSection &Section)
static uint64_t getSymbolValue(const MCSymbol &Symbol, const MCAsmLayout &Layout)
static std::time_t getTime()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
Implements a dense probed hash-table based set.
Interval Class - An Interval is a set of nodes defined such that every node in the interval has all o...
Encapsulates the layout of an assembly file at a particular point in time.
const MCSymbol * getBaseSymbol(const MCSymbol &Symbol) const
If this symbol is equivalent to A + Constant, return A.
uint64_t getSectionAddressSize(const MCSection *Sec) const
Get the address space size of the given section, as it effects layout.
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
Fragment for data and encoded instructions.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSection * getParent() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
virtual uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout)=0
Write the object file and returns the number of bytes written.
virtual void executePostLayoutBinding(MCAssembler &Asm, const MCAsmLayout &Layout)=0
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
virtual void reset()
lifetime management
virtual bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, const MCSymbol &A, const MCSymbol &B, bool InSet) const
virtual void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
Record a relocation entry.
This represents a section on Windows.
MCSymbol * getCOMDATSymbol() const
unsigned getCharacteristics() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSection::FragmentListType & getFragmentList()
StringRef getName() const
uint16_t getClass() const
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute).
StringRef getName() const
getName - Get the symbol name.
bool isVariable() const
isVariable - Check if this is a variable symbol.
void setIndex(uint32_t Value) const
Set the (implementation defined) index.
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
uint32_t getIndex() const
Get the (implementation defined) index.
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
MCFragment * getFragment(bool SetUsed=true) const
This represents an "assembler immediate".
MCWinCOFFObjectTargetWriter(unsigned Machine_)
Represents a location in source code.
static SectionKind getMetadata()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
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.
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.
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.
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_UNKNOWN
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_ARMNT
@ IMAGE_SCN_ALIGN_64BYTES
@ IMAGE_SCN_ALIGN_128BYTES
@ IMAGE_SCN_ALIGN_256BYTES
@ IMAGE_SCN_ALIGN_1024BYTES
@ IMAGE_SCN_ALIGN_512BYTES
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
@ IMAGE_SCN_ALIGN_4096BYTES
@ IMAGE_SCN_ALIGN_8192BYTES
@ IMAGE_SCN_LNK_NRELOC_OVFL
@ IMAGE_SCN_ALIGN_16BYTES
@ IMAGE_SCN_ALIGN_32BYTES
@ IMAGE_SCN_ALIGN_2048BYTES
@ IMAGE_SYM_CLASS_EXTERNAL
External symbol.
@ IMAGE_SYM_CLASS_LABEL
Label.
@ IMAGE_SYM_CLASS_FILE
File name.
@ IMAGE_SYM_CLASS_NULL
No symbol.
@ IMAGE_SYM_CLASS_WEAK_EXTERNAL
Duplicate tag.
@ IMAGE_SYM_CLASS_STATIC
Static.
bool encodeSectionName(char *Out, uint64_t Offset)
Encode section name based on string table offset.
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
@ IMAGE_WEAK_EXTERN_SEARCH_ALIAS
@ IMAGE_REL_ARM_BRANCH20T
@ IMAGE_REL_ARM_BRANCH24T
const int32_t MaxNumberOfSections16
static const char BigObjMagic[]
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
DenseMap< SymbolStringPtr, ExecutorSymbolDef > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
void write32le(void *P, uint32_t V)
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
void sort(IteratorTy Start, IteratorTy End)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ FK_SecRel_2
A two-byte section relative fixup.
std::unique_ptr< MCObjectWriter > createWinCOFFObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Win COFF writer instance.
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.
uint64_t value() const
This is a hole in the type system and should not be abused.
uint32_t PointerToRelocations
uint16_t NumberOfLineNumbers
uint32_t PointerToRawData
uint16_t NumberOfRelocations
uint32_t PointerToLineNumbers
const MCSymbolRefExpr * From
const MCSymbolRefExpr * To
An iterator type that allows iterating over the pointees via some other iterator.
Adapter to write values to a stream in a particular byte order.