53#define DEBUG_TYPE "WinCOFFObjectWriter"
57constexpr int OffsetLabelIntervalBits = 20;
61enum AuxiliaryType { ATWeakExternal, ATFile, ATSectionDefinition };
79 COFFSymbol *
Other =
nullptr;
80 COFFSection *Section =
nullptr;
84 COFFSymbol(
StringRef Name) : Name(Name) {}
88 int64_t getIndex()
const {
return Index; }
89 void setIndex(
int Value) {
97struct COFFRelocation {
99 COFFSymbol *Symb =
nullptr;
101 COFFRelocation() =
default;
106using relocations = std::vector<COFFRelocation>;
115 COFFSymbol *Symbol =
nullptr;
116 relocations Relocations;
118 COFFSection(
StringRef Name) : Name(std::string(Name)) {}
128 using symbols = std::vector<std::unique_ptr<COFFSymbol>>;
129 using sections = std::vector<std::unique_ptr<COFFSection>>;
149 bool UseOffsetLabels =
false;
170 COFFSymbol *GetOrCreateCOFFSymbol(
const MCSymbol *Symbol);
175 COFFSymbol *getLinkedSymbol(
const MCSymbol &Symbol);
178 void SetSymbolName(COFFSymbol &S);
179 void SetSectionName(COFFSection &S);
181 bool IsPhysicalSection(COFFSection *S);
185 void WriteSymbol(
const COFFSymbol &S);
187 void writeSectionHeaders();
190 void writeSection(
MCAssembler &Asm,
const COFFSection &Sec);
193 void setWeakDefaultNames();
194 void assignSectionNumbers();
200 : TargetObjectWriter(
std::
move(MOTW)),
206 : TargetObjectWriter(
std::
move(MOTW)),
233 Header.
Machine = OWriter.TargetObjectWriter->getMachine();
242 Symbols.push_back(std::make_unique<COFFSymbol>(
Name));
243 return Symbols.back().get();
246COFFSymbol *WinCOFFWriter::GetOrCreateCOFFSymbol(
const MCSymbol *Symbol) {
247 COFFSymbol *&Ret = SymbolMap[Symbol];
249 Ret = createSymbol(Symbol->getName());
254 Sections.emplace_back(std::make_unique<COFFSection>(
Name));
255 return Sections.back().get();
294void WinCOFFWriter::defineSection(
const MCAssembler &Asm,
306 COFFSymbol *COMDATSymbol = GetOrCreateCOFFSymbol(S);
307 if (COMDATSymbol->Section)
309 COMDATSymbol->Section =
Section;
316 Symbol->Aux[0].AuxType = ATSectionDefinition;
327 if (UseOffsetLabels && !MCSec.
empty()) {
337 Section->OffsetSymbols.push_back(Label);
343 if (Symbol.isCommon() && Symbol.isExternal())
344 return Symbol.getCommonSize();
347 if (!Asm.getSymbolOffset(Symbol, Res))
353COFFSymbol *WinCOFFWriter::getLinkedSymbol(
const MCSymbol &Symbol) {
358 dyn_cast<MCSymbolRefExpr>(
Symbol.getVariableValue());
364 return GetOrCreateCOFFSymbol(&Aliasee);
371void WinCOFFWriter::defineSymbol(
const MCAssembler &Asm,
374 COFFSection *Sec =
nullptr;
377 MCSec = cast<MCSectionCOFF>(
Base->getFragment()->getParent());
378 Sec = SectionMap[MCSec];
384 COFFSymbol *
Sym = GetOrCreateCOFFSymbol(&MCSym);
385 COFFSymbol *
Local =
nullptr;
386 if (cast<MCSymbolCOFF>(MCSym).getWeakExternalCharacteristics()) {
388 Sym->Section =
nullptr;
390 COFFSymbol *WeakDefault = getLinkedSymbol(MCSym);
392 std::string WeakName = (
".weak." + MCSym.
getName() +
".default").str();
393 WeakDefault = createSymbol(WeakName);
397 WeakDefault->Section = Sec;
398 WeakDefaults.
insert(WeakDefault);
402 Sym->Other = WeakDefault;
406 memset(&
Sym->Aux[0], 0,
sizeof(
Sym->Aux[0]));
407 Sym->Aux[0].AuxType = ATWeakExternal;
408 Sym->Aux[0].Aux.WeakExternal.TagIndex = 0;
409 Sym->Aux[0].Aux.WeakExternal.Characteristics =
410 cast<MCSymbolCOFF>(MCSym).getWeakExternalCharacteristics();
422 const MCSymbolCOFF &SymbolCOFF = cast<MCSymbolCOFF>(MCSym);
439void WinCOFFWriter::SetSectionName(COFFSection &S) {
441 std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size());
450void WinCOFFWriter::SetSymbolName(COFFSymbol &S) {
452 S.set_name_offset(Strings.
getOffset(S.Name));
454 std::memcpy(S.Data.Name, S.Name.c_str(), S.Name.size());
457bool WinCOFFWriter::IsPhysicalSection(COFFSection *S) {
465void WinCOFFWriter::WriteFileHeader(
const COFF::header &Header) {
482 W.
write<
uint16_t>(
static_cast<int16_t
>(Header.NumberOfSections));
491void WinCOFFWriter::WriteSymbol(
const COFFSymbol &S) {
497 W.
write<
uint16_t>(
static_cast<int16_t
>(S.Data.SectionNumber));
499 W.
OS <<
char(S.Data.StorageClass);
500 W.
OS <<
char(S.Data.NumberOfAuxSymbols);
501 WriteAuxiliarySymbols(S.Aux);
504void WinCOFFWriter::WriteAuxiliarySymbols(
506 for (
const AuxSymbol &i : S) {
516 W.
OS.
write(
reinterpret_cast<const char *
>(&i.Aux),
519 case ATSectionDefinition:
521 W.
write<
uint16_t>(i.Aux.SectionDefinition.NumberOfRelocations);
522 W.
write<
uint16_t>(i.Aux.SectionDefinition.NumberOfLinenumbers);
524 W.
write<
uint16_t>(
static_cast<int16_t
>(i.Aux.SectionDefinition.Number));
525 W.
OS <<
char(i.Aux.SectionDefinition.Selection);
528 static_cast<int16_t
>(i.Aux.SectionDefinition.Number >> 16));
537void WinCOFFWriter::writeSectionHeaders() {
541 std::vector<COFFSection *> Arr;
542 for (
auto &Section : Sections)
544 llvm::sort(Arr, [](
const COFFSection *
A,
const COFFSection *
B) {
545 return A->Number <
B->Number;
548 for (
auto &Section : Arr) {
553 if (
Section->Relocations.size() >= 0xffff)
583 Asm.writeSectionData(VecOS, &MCSec);
595void WinCOFFWriter::writeSection(
MCAssembler &Asm,
const COFFSection &Sec) {
596 if (Sec.Number == -1)
600 if (Sec.Header.PointerToRawData != 0) {
602 "Section::PointerToRawData is insane!");
604 uint32_t CRC = writeSectionContents(Asm, *Sec.MCSection);
608 assert(AuxSyms.
size() == 1 && AuxSyms[0].AuxType == ATSectionDefinition);
609 AuxSymbol &SecDef = AuxSyms[0];
610 SecDef.Aux.SectionDefinition.CheckSum = CRC;
614 if (Sec.Relocations.empty()) {
615 assert(Sec.Header.PointerToRelocations == 0 &&
616 "Section::PointerToRelocations is insane!");
620 assert(W.
OS.
tell() == Sec.Header.PointerToRelocations &&
621 "Section::PointerToRelocations is insane!");
623 if (Sec.Relocations.size() >= 0xffff) {
627 R.VirtualAddress = Sec.Relocations.size() + 1;
628 R.SymbolTableIndex = 0;
633 for (
const auto &Relocation : Sec.Relocations)
634 WriteRelocation(Relocation.Data);
638void WinCOFFWriter::createFileSymbols(
MCAssembler &Asm) {
639 for (
const std::pair<std::string, size_t> &It : OWriter.
getFileNames()) {
641 const std::string &
Name = It.first;
643 unsigned Count = (
Name.size() + SymbolSize - 1) / SymbolSize;
645 COFFSymbol *
File = createSymbol(
".file");
648 File->Aux.resize(Count);
652 for (
auto &Aux :
File->Aux) {
653 Aux.AuxType = ATFile;
655 if (
Length > SymbolSize) {
656 memcpy(&Aux.Aux,
Name.c_str() +
Offset, SymbolSize);
660 memset((
char *)&Aux.Aux +
Length, 0, SymbolSize -
Length);
669void WinCOFFWriter::setWeakDefaultNames() {
670 if (WeakDefaults.
empty())
680 COFFSymbol *Unique =
nullptr;
681 for (
bool AllowComdat : {
false,
true}) {
682 for (
auto &
Sym : Symbols) {
692 if (!AllowComdat &&
Sym->Section &&
704 for (
auto *
Sym : WeakDefaults) {
705 Sym->Name.append(
".");
706 Sym->Name.append(Unique->Name);
711 return Section.Symbol->Aux[0].Aux.SectionDefinition.Selection ==
715void WinCOFFWriter::assignSectionNumbers() {
719 Section.Symbol->Data.SectionNumber =
I;
720 Section.Symbol->Aux[0].Aux.SectionDefinition.Number =
I;
727 for (
const std::unique_ptr<COFFSection> &Section : Sections)
730 for (
const std::unique_ptr<COFFSection> &Section : Sections)
736void WinCOFFWriter::assignFileOffsets(
MCAssembler &Asm) {
742 for (
const auto &Section : Asm) {
743 COFFSection *Sec = SectionMap[&
Section];
745 if (!Sec || Sec->Number == -1)
748 Sec->Header.SizeOfRawData =
Asm.getSectionAddressSize(Section);
750 if (IsPhysicalSection(Sec)) {
751 Sec->Header.PointerToRawData =
Offset;
752 Offset += Sec->Header.SizeOfRawData;
755 if (!Sec->Relocations.empty()) {
756 bool RelocationsOverflow = Sec->Relocations.size() >= 0xffff;
758 if (RelocationsOverflow) {
761 Sec->Header.NumberOfRelocations = 0xffff;
763 Sec->Header.NumberOfRelocations = Sec->Relocations.size();
765 Sec->Header.PointerToRelocations =
Offset;
767 if (RelocationsOverflow) {
774 for (
auto &Relocation : Sec->Relocations) {
775 assert(Relocation.Symb->getIndex() != -1);
776 Relocation.Data.SymbolTableIndex = Relocation.Symb->getIndex();
780 assert(Sec->Symbol->Aux.size() == 1 &&
781 "Section's symbol must have one aux!");
782 AuxSymbol &Aux = Sec->Symbol->Aux[0];
783 assert(Aux.AuxType == ATSectionDefinition &&
784 "Section's symbol's aux symbol must be a Section Definition!");
785 Aux.Aux.SectionDefinition.Length = Sec->Header.SizeOfRawData;
786 Aux.Aux.SectionDefinition.NumberOfRelocations =
787 Sec->Header.NumberOfRelocations;
788 Aux.Aux.SectionDefinition.NumberOfLinenumbers =
789 Sec->Header.NumberOfLineNumbers;
792 Header.PointerToSymbolTable =
Offset;
796 memset(&Header, 0,
sizeof(Header));
797 Header.Machine = OWriter.TargetObjectWriter->getMachine();
803 WeakDefaults.clear();
809 for (
const auto &Section : Asm) {
813 defineSection(Asm,
static_cast<const MCSectionCOFF &
>(Section));
817 for (
const MCSymbol &Symbol : Asm.symbols())
819 if (!Symbol.isTemporary() ||
821 defineSymbol(Asm, Symbol);
828 assert(
Target.getSymA() &&
"Relocation must reference a symbol!");
831 if (!
A.isRegistered()) {
832 Asm.getContext().reportError(
Fixup.getLoc(),
Twine(
"symbol '") +
834 "' can not be undefined");
837 if (
A.isTemporary() &&
A.isUndefined()) {
838 Asm.getContext().reportError(
Fixup.getLoc(),
Twine(
"assembler label '") +
840 "' can not be undefined");
848 "Section must already have been defined in executePostLayoutBinding!");
850 COFFSection *Sec = SectionMap[MCSec];
855 if (!
B->getFragment()) {
856 Asm.getContext().reportError(
858 Twine(
"symbol '") +
B->getName() +
859 "' can not be undefined in a subtraction expression");
864 int64_t OffsetOfB = Asm.getSymbolOffset(*
B);
867 int64_t OffsetOfRelocation =
868 Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
870 FixedValue = (OffsetOfRelocation - OffsetOfB) +
Target.getConstant();
872 FixedValue =
Target.getConstant();
875 COFFRelocation Reloc;
877 Reloc.Data.SymbolTableIndex = 0;
878 Reloc.Data.VirtualAddress = Asm.getFragmentOffset(*Fragment);
881 if (
A.isTemporary() && !SymbolMap[&
A]) {
884 SectionMap.
contains(TargetSection) &&
885 "Section must already have been defined in executePostLayoutBinding!");
886 COFFSection *Section = SectionMap[TargetSection];
887 Reloc.Symb = Section->Symbol;
888 FixedValue += Asm.getSymbolOffset(
A);
893 if (UseOffsetLabels && !Section->OffsetSymbols.empty()) {
894 uint64_t LabelIndex = FixedValue >> OffsetLabelIntervalBits;
895 if (LabelIndex > 0) {
896 if (LabelIndex <= Section->OffsetSymbols.size())
897 Reloc.Symb = Section->OffsetSymbols[LabelIndex - 1];
899 Reloc.Symb = Section->OffsetSymbols.back();
900 FixedValue -= Reloc.Symb->Data.Value;
906 "Symbol must already have been defined in executePostLayoutBinding!");
907 Reloc.Symb = SymbolMap[&
A];
910 ++Reloc.Symb->Relocations;
912 Reloc.Data.VirtualAddress +=
Fixup.getOffset();
913 Reloc.Data.Type = OWriter.TargetObjectWriter->getRelocType(
914 Asm.getContext(),
Target,
Fixup, SymB, Asm.getBackend());
929 switch (Reloc.Data.Type) {
961 FixedValue = FixedValue + 4;
970 if (OWriter.TargetObjectWriter->recordRelocation(
Fixup))
971 Sec->Relocations.push_back(Reloc);
975 std::time_t Now = time(
nullptr);
976 if (Now < 0 || !isUInt<32>(Now))
984 if (Sections.size() > INT32_MAX)
986 "PE COFF object files can't have more than 2147483647 sections");
989 Header.NumberOfSections = Sections.size();
990 Header.NumberOfSymbols = 0;
992 setWeakDefaultNames();
993 assignSectionNumbers();
995 createFileSymbols(Asm);
997 for (
auto &Symbol : Symbols) {
1000 Symbol->Data.SectionNumber = Symbol->Section->Number;
1001 Symbol->setIndex(Header.NumberOfSymbols++);
1003 Symbol->Data.NumberOfAuxSymbols = Symbol->Aux.size();
1004 Header.NumberOfSymbols += Symbol->Data.NumberOfAuxSymbols;
1008 for (
const auto &S : Sections)
1011 for (
const auto &S : Symbols)
1017 for (
const auto &S : Sections)
1019 for (
auto &S : Symbols)
1023 for (
auto &Symbol : Symbols) {
1024 if (Symbol->Other) {
1025 assert(Symbol->getIndex() != -1);
1026 assert(Symbol->Aux.size() == 1 &&
"Symbol must contain one aux symbol!");
1027 assert(Symbol->Aux[0].AuxType == ATWeakExternal &&
1028 "Symbol's aux symbol must be a Weak External!");
1029 Symbol->Aux[0].Aux.WeakExternal.TagIndex = Symbol->Other->getIndex();
1034 for (
auto &Section : Sections) {
1035 if (Section->Symbol->Aux[0].Aux.SectionDefinition.Selection !=
1046 Asm.getContext().reportError(
1048 Twine(
" associative with sectionless symbol ") +
1053 const auto *AssocMCSec = cast<MCSectionCOFF>(&AssocMCSym->
getSection());
1055 COFFSection *AssocSec = SectionMap[AssocMCSec];
1058 if (AssocSec->Number == -1)
1061 Section->Symbol->Aux[0].Aux.SectionDefinition.Number = AssocSec->Number;
1066 auto *Sec = Asm.getContext().getCOFFSection(
1068 auto *Frag = cast<MCDataFragment>(Sec->curFragList()->Head);
1080 "Section must already have been defined in "
1081 "executePostLayoutBinding!");
1088 auto *Sec = Asm.getContext().getCOFFSection(
1090 auto *Frag = cast<MCDataFragment>(Sec->curFragList()->Head);
1093 uint32_t FromIndex = CGPE.From->getSymbol().getIndex();
1094 uint32_t ToIndex = CGPE.To->getSymbol().getIndex();
1101 assignFileOffsets(Asm);
1105 if (OWriter.IncrementalLinkerCompatible) {
1106 Header.TimeDateStamp =
getTime();
1109 Header.TimeDateStamp = 0;
1113 WriteFileHeader(Header);
1114 writeSectionHeaders();
1117 sections::iterator
I = Sections.begin();
1118 sections::iterator IE = Sections.end();
1119 auto J = Asm.begin();
1120 auto JE = Asm.end();
1121 for (;
I != IE && J != JE; ++
I, ++J) {
1125 assert(J != JE && (**I).MCSection == &*J &&
"Wrong bound MCSection");
1130 for (std::unique_ptr<COFFSection> &Sec : Sections)
1131 writeSection(Asm, *Sec);
1134 "Header::PointerToSymbolTable is insane!");
1137 for (
auto &Symbol : Symbols)
1138 if (Symbol->getIndex() != -1)
1139 WriteSymbol(*Symbol);
1144 return W.
OS.
tell() - StartOffset;
1154 IncrementalLinkerCompatible =
false;
1163 bool InSet,
bool IsPCRel)
const {
1177 ObjWriter->executePostLayoutBinding(Asm);
1179 DwoWriter->executePostLayoutBinding(Asm);
1187 "No relocation in Dwo sections");
1188 ObjWriter->recordRelocation(Asm, Fragment,
Fixup,
Target, FixedValue);
1192 uint64_t TotalSize = ObjWriter->writeObject(Asm);
1194 TotalSize += DwoWriter->writeObject(Asm);
1202void MCWinCOFFObjectTargetWriter::anchor() {}
1209 return std::make_unique<WinCOFFObjectWriter>(std::move(MOTW),
OS);
1215 return std::make_unique<WinCOFFObjectWriter>(std::move(MOTW),
OS, DwoOS);
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
COFFYAML::AuxSymbolType AuxType
COFF::MachineTypes Machine
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
std::optional< std::vector< StOtherPiece > > Other
std::pair< uint64_t, uint64_t > Interval
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 uint64_t getSymbolValue(const MCSymbol &Symbol, const MCAssembler &Asm)
static uint32_t getAlignment(const MCSectionCOFF &Sec)
static bool isAssociative(const COFFSection &Section)
static bool isDwoSection(const MCSection &Sec)
static std::time_t getTime()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
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()
virtual void reset()
lifetime management
SmallVector< CGProfileEntry, 0 > & getCGProfile()
std::vector< const MCSymbol * > AddrsigSyms
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.
StringRef getName() const
MCSymbol * getBeginSymbol()
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.
bool isRegistered() const
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.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
MCFragment * getFragment(bool SetUsed=true) const
This represents an "assembler immediate".
MCWinCOFFObjectTargetWriter(unsigned Machine_)
Represents a location in source code.
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.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Utility for building string tables with deduplicated suffixes.
size_t getOffset(CachedHashStringRef S) const
Get the offest of a string in the string table.
void write(raw_ostream &OS) const
size_t add(CachedHashStringRef S)
Add a string to the builder.
void finalize()
Analyze the strings and build the final table.
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.
void reset() override
lifetime management
void recordRelocation(MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) override
Record a relocation entry.
WinCOFFObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB, bool InSet, bool IsPCRel) const override
void executePostLayoutBinding(MCAssembler &Asm) override
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
uint64_t writeObject(MCAssembler &Asm) override
Write the object file and returns the number of bytes written.
uint64_t writeObject(MCAssembler &Asm)
WinCOFFWriter(WinCOFFObjectWriter &OWriter, raw_pwrite_stream &OS, DwoMode Mode)
enum llvm::WinCOFFWriter::DwoMode Mode
void recordRelocation(MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)
void executePostLayoutBinding(MCAssembler &Asm)
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
uint64_t tell() const
tell - Return the current offset with the file.
raw_ostream & write(unsigned char C)
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_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
bool isAnyArm64(T Machine)
@ 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_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))
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.
std::unique_ptr< MCObjectWriter > createWinCOFFDwoObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS)
@ 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.
Implement std::hash so that hash_code can be used in STL containers.
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
Adapter to write values to a stream in a particular byte order.
void write(ArrayRef< value_type > Val)