52#define DEBUG_TYPE "WinCOFFObjectWriter"
56constexpr int OffsetLabelIntervalBits = 20;
60enum AuxiliaryType { ATWeakExternal, ATFile, ATSectionDefinition };
78 COFFSymbol *
Other =
nullptr;
79 COFFSection *Section =
nullptr;
83 COFFSymbol(
StringRef Name) : Name(Name) {}
87 int64_t getIndex()
const {
return Index; }
88 void setIndex(
int Value) {
96struct COFFRelocation {
98 COFFSymbol *Symb =
nullptr;
100 COFFRelocation() =
default;
105using relocations = std::vector<COFFRelocation>;
114 COFFSymbol *Symbol =
nullptr;
115 relocations Relocations;
117 COFFSection(
StringRef Name) : Name(std::string(Name)) {}
127 using symbols = std::vector<std::unique_ptr<COFFSymbol>>;
128 using sections = std::vector<std::unique_ptr<COFFSection>>;
148 bool UseOffsetLabels =
false;
169 COFFSymbol *GetOrCreateCOFFSymbol(
const MCSymbol *Symbol);
174 COFFSymbol *getLinkedSymbol(
const MCSymbol &Symbol);
177 void SetSymbolName(COFFSymbol &S);
178 void SetSectionName(COFFSection &S);
180 bool IsPhysicalSection(COFFSection *S);
184 void WriteSymbol(
const COFFSymbol &S);
186 void writeSectionHeaders();
189 void writeSection(
MCAssembler &Asm,
const COFFSection &Sec);
192 void setWeakDefaultNames();
193 void assignSectionNumbers();
199 : TargetObjectWriter(
std::
move(MOTW)),
205 : TargetObjectWriter(
std::
move(MOTW)),
232 Header.
Machine = OWriter.TargetObjectWriter->getMachine();
241 Symbols.push_back(std::make_unique<COFFSymbol>(
Name));
242 return Symbols.back().get();
245COFFSymbol *WinCOFFWriter::GetOrCreateCOFFSymbol(
const MCSymbol *Symbol) {
246 COFFSymbol *&Ret = SymbolMap[Symbol];
248 Ret = createSymbol(Symbol->getName());
253 Sections.emplace_back(std::make_unique<COFFSection>(
Name));
254 return Sections.back().get();
293void WinCOFFWriter::defineSection(
const MCAssembler &Asm,
305 COFFSymbol *COMDATSymbol = GetOrCreateCOFFSymbol(S);
306 if (COMDATSymbol->Section)
308 COMDATSymbol->Section =
Section;
315 Symbol->Aux[0].AuxType = ATSectionDefinition;
326 if (UseOffsetLabels) {
336 Section->OffsetSymbols.push_back(Label);
342 if (Symbol.isCommon() && Symbol.isExternal())
343 return Symbol.getCommonSize();
346 if (!Asm.getSymbolOffset(Symbol, Res))
352COFFSymbol *WinCOFFWriter::getLinkedSymbol(
const MCSymbol &Symbol) {
357 dyn_cast<MCSymbolRefExpr>(
Symbol.getVariableValue());
363 return GetOrCreateCOFFSymbol(&Aliasee);
370void WinCOFFWriter::defineSymbol(
const MCAssembler &Asm,
373 COFFSection *Sec =
nullptr;
376 MCSec = cast<MCSectionCOFF>(
Base->getFragment()->getParent());
377 Sec = SectionMap[MCSec];
383 COFFSymbol *
Sym = GetOrCreateCOFFSymbol(&MCSym);
384 COFFSymbol *
Local =
nullptr;
385 if (cast<MCSymbolCOFF>(MCSym).getWeakExternalCharacteristics()) {
387 Sym->Section =
nullptr;
389 COFFSymbol *WeakDefault = getLinkedSymbol(MCSym);
391 std::string WeakName = (
".weak." + MCSym.
getName() +
".default").str();
392 WeakDefault = createSymbol(WeakName);
396 WeakDefault->Section = Sec;
397 WeakDefaults.
insert(WeakDefault);
401 Sym->Other = WeakDefault;
405 memset(&
Sym->Aux[0], 0,
sizeof(
Sym->Aux[0]));
406 Sym->Aux[0].AuxType = ATWeakExternal;
407 Sym->Aux[0].Aux.WeakExternal.TagIndex = 0;
408 Sym->Aux[0].Aux.WeakExternal.Characteristics =
409 cast<MCSymbolCOFF>(MCSym).getWeakExternalCharacteristics();
421 const MCSymbolCOFF &SymbolCOFF = cast<MCSymbolCOFF>(MCSym);
438void WinCOFFWriter::SetSectionName(COFFSection &S) {
440 std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size());
449void WinCOFFWriter::SetSymbolName(COFFSymbol &S) {
451 S.set_name_offset(Strings.
getOffset(S.Name));
453 std::memcpy(S.Data.Name, S.Name.c_str(), S.Name.size());
456bool WinCOFFWriter::IsPhysicalSection(COFFSection *S) {
464void WinCOFFWriter::WriteFileHeader(
const COFF::header &Header) {
481 W.
write<
uint16_t>(
static_cast<int16_t
>(Header.NumberOfSections));
490void WinCOFFWriter::WriteSymbol(
const COFFSymbol &S) {
496 W.
write<
uint16_t>(
static_cast<int16_t
>(S.Data.SectionNumber));
498 W.
OS <<
char(S.Data.StorageClass);
499 W.
OS <<
char(S.Data.NumberOfAuxSymbols);
500 WriteAuxiliarySymbols(S.Aux);
503void WinCOFFWriter::WriteAuxiliarySymbols(
505 for (
const AuxSymbol &i : S) {
515 W.
OS.
write(
reinterpret_cast<const char *
>(&i.Aux),
518 case ATSectionDefinition:
520 W.
write<
uint16_t>(i.Aux.SectionDefinition.NumberOfRelocations);
521 W.
write<
uint16_t>(i.Aux.SectionDefinition.NumberOfLinenumbers);
523 W.
write<
uint16_t>(
static_cast<int16_t
>(i.Aux.SectionDefinition.Number));
524 W.
OS <<
char(i.Aux.SectionDefinition.Selection);
527 static_cast<int16_t
>(i.Aux.SectionDefinition.Number >> 16));
536void WinCOFFWriter::writeSectionHeaders() {
540 std::vector<COFFSection *> Arr;
541 for (
auto &Section : Sections)
543 llvm::sort(Arr, [](
const COFFSection *
A,
const COFFSection *
B) {
544 return A->Number <
B->Number;
547 for (
auto &Section : Arr) {
552 if (
Section->Relocations.size() >= 0xffff)
582 Asm.writeSectionData(VecOS, &MCSec);
594void WinCOFFWriter::writeSection(
MCAssembler &Asm,
const COFFSection &Sec) {
595 if (Sec.Number == -1)
599 if (Sec.Header.PointerToRawData != 0) {
601 "Section::PointerToRawData is insane!");
603 uint32_t CRC = writeSectionContents(Asm, *Sec.MCSection);
607 assert(AuxSyms.
size() == 1 && AuxSyms[0].AuxType == ATSectionDefinition);
608 AuxSymbol &SecDef = AuxSyms[0];
609 SecDef.Aux.SectionDefinition.CheckSum = CRC;
613 if (Sec.Relocations.empty()) {
614 assert(Sec.Header.PointerToRelocations == 0 &&
615 "Section::PointerToRelocations is insane!");
619 assert(W.
OS.
tell() == Sec.Header.PointerToRelocations &&
620 "Section::PointerToRelocations is insane!");
622 if (Sec.Relocations.size() >= 0xffff) {
626 R.VirtualAddress = Sec.Relocations.size() + 1;
627 R.SymbolTableIndex = 0;
632 for (
const auto &Relocation : Sec.Relocations)
633 WriteRelocation(Relocation.Data);
637void WinCOFFWriter::createFileSymbols(
MCAssembler &Asm) {
638 for (
const std::pair<std::string, size_t> &It : OWriter.
getFileNames()) {
640 const std::string &
Name = It.first;
642 unsigned Count = (
Name.size() + SymbolSize - 1) / SymbolSize;
644 COFFSymbol *
File = createSymbol(
".file");
647 File->Aux.resize(Count);
651 for (
auto &Aux :
File->Aux) {
652 Aux.AuxType = ATFile;
654 if (
Length > SymbolSize) {
655 memcpy(&Aux.Aux,
Name.c_str() +
Offset, SymbolSize);
659 memset((
char *)&Aux.Aux +
Length, 0, SymbolSize -
Length);
668void WinCOFFWriter::setWeakDefaultNames() {
669 if (WeakDefaults.
empty())
679 COFFSymbol *Unique =
nullptr;
680 for (
bool AllowComdat : {
false,
true}) {
681 for (
auto &
Sym : Symbols) {
691 if (!AllowComdat &&
Sym->Section &&
703 for (
auto *
Sym : WeakDefaults) {
704 Sym->Name.append(
".");
705 Sym->Name.append(Unique->Name);
710 return Section.Symbol->Aux[0].Aux.SectionDefinition.Selection ==
714void WinCOFFWriter::assignSectionNumbers() {
718 Section.Symbol->Data.SectionNumber =
I;
719 Section.Symbol->Aux[0].Aux.SectionDefinition.Number =
I;
726 for (
const std::unique_ptr<COFFSection> &Section : Sections)
729 for (
const std::unique_ptr<COFFSection> &Section : Sections)
735void WinCOFFWriter::assignFileOffsets(
MCAssembler &Asm) {
741 for (
const auto &Section : Asm) {
742 COFFSection *Sec = SectionMap[&
Section];
744 if (!Sec || Sec->Number == -1)
747 Sec->Header.SizeOfRawData =
Asm.getSectionAddressSize(Section);
749 if (IsPhysicalSection(Sec)) {
750 Sec->Header.PointerToRawData =
Offset;
751 Offset += Sec->Header.SizeOfRawData;
754 if (!Sec->Relocations.empty()) {
755 bool RelocationsOverflow = Sec->Relocations.size() >= 0xffff;
757 if (RelocationsOverflow) {
760 Sec->Header.NumberOfRelocations = 0xffff;
762 Sec->Header.NumberOfRelocations = Sec->Relocations.size();
764 Sec->Header.PointerToRelocations =
Offset;
766 if (RelocationsOverflow) {
773 for (
auto &Relocation : Sec->Relocations) {
774 assert(Relocation.Symb->getIndex() != -1);
775 Relocation.Data.SymbolTableIndex = Relocation.Symb->getIndex();
779 assert(Sec->Symbol->Aux.size() == 1 &&
780 "Section's symbol must have one aux!");
781 AuxSymbol &Aux = Sec->Symbol->Aux[0];
782 assert(Aux.AuxType == ATSectionDefinition &&
783 "Section's symbol's aux symbol must be a Section Definition!");
784 Aux.Aux.SectionDefinition.Length = Sec->Header.SizeOfRawData;
785 Aux.Aux.SectionDefinition.NumberOfRelocations =
786 Sec->Header.NumberOfRelocations;
787 Aux.Aux.SectionDefinition.NumberOfLinenumbers =
788 Sec->Header.NumberOfLineNumbers;
791 Header.PointerToSymbolTable =
Offset;
795 memset(&Header, 0,
sizeof(Header));
796 Header.Machine = OWriter.TargetObjectWriter->getMachine();
802 WeakDefaults.clear();
808 for (
const auto &Section : Asm) {
812 defineSection(Asm,
static_cast<const MCSectionCOFF &
>(Section));
816 for (
const MCSymbol &Symbol : Asm.symbols())
818 if (!Symbol.isTemporary() ||
820 defineSymbol(Asm, Symbol);
827 assert(
Target.getSymA() &&
"Relocation must reference a symbol!");
830 if (!
A.isRegistered()) {
831 Asm.getContext().reportError(
Fixup.getLoc(),
Twine(
"symbol '") +
833 "' can not be undefined");
836 if (
A.isTemporary() &&
A.isUndefined()) {
837 Asm.getContext().reportError(
Fixup.getLoc(),
Twine(
"assembler label '") +
839 "' can not be undefined");
847 "Section must already have been defined in executePostLayoutBinding!");
849 COFFSection *Sec = SectionMap[MCSec];
854 if (!
B->getFragment()) {
855 Asm.getContext().reportError(
857 Twine(
"symbol '") +
B->getName() +
858 "' can not be undefined in a subtraction expression");
863 int64_t OffsetOfB = Asm.getSymbolOffset(*
B);
866 int64_t OffsetOfRelocation =
867 Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
869 FixedValue = (OffsetOfRelocation - OffsetOfB) +
Target.getConstant();
871 FixedValue =
Target.getConstant();
874 COFFRelocation Reloc;
876 Reloc.Data.SymbolTableIndex = 0;
877 Reloc.Data.VirtualAddress = Asm.getFragmentOffset(*Fragment);
880 if (
A.isTemporary() && !SymbolMap[&
A]) {
883 SectionMap.
contains(TargetSection) &&
884 "Section must already have been defined in executePostLayoutBinding!");
885 COFFSection *Section = SectionMap[TargetSection];
886 Reloc.Symb = Section->Symbol;
887 FixedValue += Asm.getSymbolOffset(
A);
892 if (UseOffsetLabels && !Section->OffsetSymbols.empty()) {
893 uint64_t LabelIndex = FixedValue >> OffsetLabelIntervalBits;
894 if (LabelIndex > 0) {
895 if (LabelIndex <= Section->OffsetSymbols.size())
896 Reloc.Symb = Section->OffsetSymbols[LabelIndex - 1];
898 Reloc.Symb = Section->OffsetSymbols.back();
899 FixedValue -= Reloc.Symb->Data.Value;
905 "Symbol must already have been defined in executePostLayoutBinding!");
906 Reloc.Symb = SymbolMap[&
A];
909 ++Reloc.Symb->Relocations;
911 Reloc.Data.VirtualAddress +=
Fixup.getOffset();
912 Reloc.Data.Type = OWriter.TargetObjectWriter->getRelocType(
913 Asm.getContext(),
Target,
Fixup, SymB, Asm.getBackend());
928 switch (Reloc.Data.Type) {
960 FixedValue = FixedValue + 4;
969 if (OWriter.TargetObjectWriter->recordRelocation(
Fixup))
970 Sec->Relocations.push_back(Reloc);
974 std::time_t Now = time(
nullptr);
975 if (Now < 0 || !isUInt<32>(Now))
983 if (Sections.size() > INT32_MAX)
985 "PE COFF object files can't have more than 2147483647 sections");
988 Header.NumberOfSections = Sections.size();
989 Header.NumberOfSymbols = 0;
991 setWeakDefaultNames();
992 assignSectionNumbers();
994 createFileSymbols(Asm);
996 for (
auto &Symbol : Symbols) {
999 Symbol->Data.SectionNumber = Symbol->Section->Number;
1000 Symbol->setIndex(Header.NumberOfSymbols++);
1002 Symbol->Data.NumberOfAuxSymbols = Symbol->Aux.size();
1003 Header.NumberOfSymbols += Symbol->Data.NumberOfAuxSymbols;
1007 for (
const auto &S : Sections)
1010 for (
const auto &S : Symbols)
1016 for (
const auto &S : Sections)
1018 for (
auto &S : Symbols)
1022 for (
auto &Symbol : Symbols) {
1023 if (Symbol->Other) {
1024 assert(Symbol->getIndex() != -1);
1025 assert(Symbol->Aux.size() == 1 &&
"Symbol must contain one aux symbol!");
1026 assert(Symbol->Aux[0].AuxType == ATWeakExternal &&
1027 "Symbol's aux symbol must be a Weak External!");
1028 Symbol->Aux[0].Aux.WeakExternal.TagIndex = Symbol->Other->getIndex();
1033 for (
auto &Section : Sections) {
1034 if (Section->Symbol->Aux[0].Aux.SectionDefinition.Selection !=
1045 Asm.getContext().reportError(
1047 Twine(
" associative with sectionless symbol ") +
1052 const auto *AssocMCSec = cast<MCSectionCOFF>(&AssocMCSym->
getSection());
1054 COFFSection *AssocSec = SectionMap[AssocMCSec];
1057 if (AssocSec->Number == -1)
1060 Section->Symbol->Aux[0].Aux.SectionDefinition.Number = AssocSec->Number;
1065 auto *Sec = Asm.getContext().getCOFFSection(
1067 auto *Frag = cast<MCDataFragment>(Sec->curFragList()->Head);
1079 "Section must already have been defined in "
1080 "executePostLayoutBinding!");
1087 auto *Sec = Asm.getContext().getCOFFSection(
1089 auto *Frag = cast<MCDataFragment>(Sec->curFragList()->Head);
1092 uint32_t FromIndex = CGPE.From->getSymbol().getIndex();
1093 uint32_t ToIndex = CGPE.To->getSymbol().getIndex();
1100 assignFileOffsets(Asm);
1104 if (OWriter.IncrementalLinkerCompatible) {
1105 Header.TimeDateStamp =
getTime();
1108 Header.TimeDateStamp = 0;
1112 WriteFileHeader(Header);
1113 writeSectionHeaders();
1116 sections::iterator
I = Sections.begin();
1117 sections::iterator IE = Sections.end();
1118 auto J = Asm.begin();
1119 auto JE = Asm.end();
1120 for (;
I != IE && J != JE; ++
I, ++J) {
1124 assert(J != JE && (**I).MCSection == &*J &&
"Wrong bound MCSection");
1129 for (std::unique_ptr<COFFSection> &Sec : Sections)
1130 writeSection(Asm, *Sec);
1133 "Header::PointerToSymbolTable is insane!");
1136 for (
auto &Symbol : Symbols)
1137 if (Symbol->getIndex() != -1)
1138 WriteSymbol(*Symbol);
1143 return W.
OS.
tell() - StartOffset;
1153 IncrementalLinkerCompatible =
false;
1162 bool InSet,
bool IsPCRel)
const {
1176 ObjWriter->executePostLayoutBinding(Asm);
1178 DwoWriter->executePostLayoutBinding(Asm);
1186 "No relocation in Dwo sections");
1187 ObjWriter->recordRelocation(Asm, Fragment,
Fixup,
Target, FixedValue);
1191 uint64_t TotalSize = ObjWriter->writeObject(Asm);
1193 TotalSize += DwoWriter->writeObject(Asm);
1201void MCWinCOFFObjectTargetWriter::anchor() {}
1208 return std::make_unique<WinCOFFObjectWriter>(std::move(MOTW),
OS);
1214 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)