LLVM 17.0.0git
COFF.h
Go to the documentation of this file.
1//===- COFF.h - COFF object file implementation -----------------*- C++ -*-===//
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//
9// This file declares the COFFObjectFile class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_OBJECT_COFF_H
14#define LLVM_OBJECT_COFF_H
15
19#include "llvm/Object/Binary.h"
21#include "llvm/Object/Error.h"
25#include "llvm/Support/Endian.h"
27#include <cassert>
28#include <cstddef>
29#include <cstdint>
30#include <system_error>
31
32namespace llvm {
33
34template <typename T> class ArrayRef;
35
36namespace object {
37
38class BaseRelocRef;
39class DelayImportDirectoryEntryRef;
40class ExportDirectoryEntryRef;
41class ImportDirectoryEntryRef;
42class ImportedSymbolRef;
43class ResourceSectionRef;
44
51
52/// The DOS compatible header at the front of all PE/COFF executables.
53struct dos_header {
54 char Magic[2];
73};
74
83
84 bool isImportLibrary() const { return NumberOfSections == 0xffff; }
85};
86
93 uint8_t UUID[16];
101};
102
103/// The 32-bit PE header that follows the COFF header.
128 // FIXME: This should be DllCharacteristics.
135 // FIXME: This should be NumberOfRvaAndSizes.
137};
138
139/// The 64-bit PE header that follows the COFF header.
170};
171
175};
176
186};
187
188template <typename IntTy>
190 IntTy Data;
191
192 bool isOrdinal() const { return Data < 0; }
193
195 assert(isOrdinal() && "ILT entry is not an ordinal!");
196 return Data & 0xFFFF;
197 }
198
200 assert(!isOrdinal() && "ILT entry is not a Hint/Name RVA!");
201 return Data & 0xFFFFFFFF;
202 }
203};
204
209
211 // dumpbin reports this field as "Characteristics" instead of "Attributes".
220};
221
234};
235
239};
240
243
247};
248
249template <typename SectionNumberType>
251 union {
255
257 SectionNumberType SectionNumber;
258
260
263};
264
267
268// Contains only common parts of coff_symbol16 and coff_symbol32.
270 union {
275};
276
279
281public:
282 COFFSymbolRef() = default;
283 COFFSymbolRef(const coff_symbol16 *CS) : CS16(CS) {}
284 COFFSymbolRef(const coff_symbol32 *CS) : CS32(CS) {}
285
286 const void *getRawPtr() const {
287 return CS16 ? static_cast<const void *>(CS16) : CS32;
288 }
289
291 if (CS16)
292 return reinterpret_cast<const coff_symbol_generic *>(CS16);
293 return reinterpret_cast<const coff_symbol_generic *>(CS32);
294 }
295
297 return A.getRawPtr() < B.getRawPtr();
298 }
299
300 bool isBigObj() const {
301 if (CS16)
302 return false;
303 if (CS32)
304 return true;
305 llvm_unreachable("COFFSymbolRef points to nothing!");
306 }
307
308 const char *getShortName() const {
309 return CS16 ? CS16->Name.ShortName : CS32->Name.ShortName;
310 }
311
313 assert(isSet() && "COFFSymbolRef points to nothing!");
314 return CS16 ? CS16->Name.Offset : CS32->Name.Offset;
315 }
316
318 assert(isSet() && "COFFSymbolRef points to nothing!");
319 return CS16 ? CS16->Value : CS32->Value;
320 }
321
322 int32_t getSectionNumber() const {
323 assert(isSet() && "COFFSymbolRef points to nothing!");
324 if (CS16) {
325 // Reserved sections are returned as negative numbers.
327 return CS16->SectionNumber;
328 return static_cast<int16_t>(CS16->SectionNumber);
329 }
330 return static_cast<int32_t>(CS32->SectionNumber);
331 }
332
334 assert(isSet() && "COFFSymbolRef points to nothing!");
335 return CS16 ? CS16->Type : CS32->Type;
336 }
337
338 uint8_t getStorageClass() const {
339 assert(isSet() && "COFFSymbolRef points to nothing!");
340 return CS16 ? CS16->StorageClass : CS32->StorageClass;
341 }
342
343 uint8_t getNumberOfAuxSymbols() const {
344 assert(isSet() && "COFFSymbolRef points to nothing!");
345 return CS16 ? CS16->NumberOfAuxSymbols : CS32->NumberOfAuxSymbols;
346 }
347
348 uint8_t getBaseType() const { return getType() & 0x0F; }
349
350 uint8_t getComplexType() const {
351 return (getType() & 0xF0) >> COFF::SCT_COMPLEX_TYPE_SHIFT;
352 }
353
354 template <typename T> const T *getAux() const {
355 return CS16 ? reinterpret_cast<const T *>(CS16 + 1)
356 : reinterpret_cast<const T *>(CS32 + 1);
357 }
358
360 if (!getNumberOfAuxSymbols() ||
362 return nullptr;
363 return getAux<coff_aux_section_definition>();
364 }
365
367 if (!getNumberOfAuxSymbols() ||
369 return nullptr;
370 return getAux<coff_aux_weak_external>();
371 }
372
373 bool isAbsolute() const {
374 return getSectionNumber() == -1;
375 }
376
377 bool isExternal() const {
379 }
380
381 bool isCommon() const {
382 return (isExternal() || isSection()) &&
384 }
385
386 bool isUndefined() const {
388 getValue() == 0;
389 }
390
391 bool isWeakExternal() const {
393 }
394
395 bool isFunctionDefinition() const {
399 }
400
401 bool isFunctionLineInfo() const {
403 }
404
405 bool isAnyUndefined() const {
406 return isUndefined() || isWeakExternal();
407 }
408
409 bool isFileRecord() const {
411 }
412
413 bool isSection() const {
415 }
416
417 bool isSectionDefinition() const {
418 // C++/CLI creates external ABS symbols for non-const appdomain globals.
419 // These are also followed by an auxiliary section definition.
420 bool isAppdomainGlobal =
423 bool isOrdinarySection = getStorageClass() == COFF::IMAGE_SYM_CLASS_STATIC;
425 return false;
426 return isAppdomainGlobal || isOrdinarySection;
427 }
428
429 bool isCLRToken() const {
431 }
432
433private:
434 bool isSet() const { return CS16 || CS32; }
435
436 const coff_symbol16 *CS16 = nullptr;
437 const coff_symbol32 *CS32 = nullptr;
438};
439
451
452 // Returns true if the actual number of relocations is stored in
453 // VirtualAddress field of the first relocation table entry.
456 NumberOfRelocations == UINT16_MAX;
457 }
458
460 // The IMAGE_SCN_TYPE_NO_PAD bit is a legacy way of getting to
461 // IMAGE_SCN_ALIGN_1BYTES.
463 return 1;
464
465 // Bit [20:24] contains section alignment. 0 means use a default alignment
466 // of 16.
467 uint32_t Shift = (Characteristics >> 20) & 0xF;
468 if (Shift > 0)
469 return 1U << (Shift - 1);
470 return 16;
471 }
472};
473
478};
479
485 char Unused1[2];
486};
487
488static_assert(sizeof(coff_aux_function_definition) == 18,
489 "auxiliary entry must be 18 bytes");
490
492 char Unused1[4];
494 char Unused2[6];
496 char Unused3[2];
497};
498
499static_assert(sizeof(coff_aux_bf_and_ef_symbol) == 18,
500 "auxiliary entry must be 18 bytes");
501
505 char Unused1[10];
506};
507
508static_assert(sizeof(coff_aux_weak_external) == 18,
509 "auxiliary entry must be 18 bytes");
510
517 uint8_t Selection;
518 uint8_t Unused;
520 int32_t getNumber(bool IsBigObj) const {
521 uint32_t Number = static_cast<uint32_t>(NumberLowPart);
522 if (IsBigObj)
523 Number |= static_cast<uint32_t>(NumberHighPart) << 16;
524 return static_cast<int32_t>(Number);
525 }
526};
527
528static_assert(sizeof(coff_aux_section_definition) == 18,
529 "auxiliary entry must be 18 bytes");
530
532 uint8_t AuxType;
533 uint8_t Reserved;
535 char MBZ[12];
536};
537
538static_assert(sizeof(coff_aux_clr_token) == 18,
539 "auxiliary entry must be 18 bytes");
540
550
551 int getType() const { return TypeInfo & 0x3; }
552 int getNameType() const { return (TypeInfo >> 2) & 0x7; }
553};
554
561
562 bool isNull() const {
563 return ImportLookupTableRVA == 0 && TimeDateStamp == 0 &&
564 ForwarderChain == 0 && NameRVA == 0 && ImportAddressTableRVA == 0;
565 }
566};
567
568template <typename IntTy>
576
578 // Bit [20:24] contains section alignment.
580 if (Shift > 0)
581 return 1U << (Shift - 1);
582 return 0;
583 }
584
586 uint32_t AlignBits = 0;
587 if (Align) {
588 assert(llvm::isPowerOf2_32(Align) && "alignment is not a power of 2");
589 assert(llvm::Log2_32(Align) <= 13 && "alignment requested is too large");
590 AlignBits = (llvm::Log2_32(Align) + 1) << 20;
591 }
593 (Characteristics & ~COFF::IMAGE_SCN_ALIGN_MASK) | AlignBits;
594 }
595};
596
599
600enum class frame_type : uint16_t { Fpo = 0, Trap = 1, Tss = 2, NonFpo = 3 };
601
607};
608
609/// 32-bit load config (IMAGE_LOAD_CONFIG_DIRECTORY32)
631
632 // Added in MSVC 2015 for /guard:cf.
637 support::ulittle32_t GuardFlags; // coff_guard_flags
638
639 // Added in MSVC 2017
654
655 // Added in MSVC 2019
665};
666
667/// 64-bit load config (IMAGE_LOAD_CONFIG_DIRECTORY64)
689
690 // Added in MSVC 2015 for /guard:cf.
696
697 // Added in MSVC 2017
712
713 // Added in MSVC 2019
723};
724
729};
730
734};
735
738
739 int getType() const { return Data >> 12; }
740 int getOffset() const { return Data & ((1 << 12) - 1); }
741};
742
744 union {
747 uint32_t getNameOffset() const {
748 return maskTrailingOnes<uint32_t>(31) & NameOffset;
749 }
750 // Even though the PE/COFF spec doesn't mention this, the high bit of a name
751 // offset is set.
752 void setNameOffset(uint32_t Offset) { NameOffset = Offset | (1 << 31); }
754 union {
757
758 bool isSubDir() const { return SubdirOffset >> 31; }
759 uint32_t value() const {
760 return maskTrailingOnes<uint32_t>(31) & SubdirOffset;
761 }
762
764};
765
771};
772
780};
781
786};
787
789private:
791
794 const coff_file_header *COFFHeader;
795 const coff_bigobj_file_header *COFFBigObjHeader;
796 const pe32_header *PE32Header;
797 const pe32plus_header *PE32PlusHeader;
798 const data_directory *DataDirectory;
799 const coff_section *SectionTable;
800 const coff_symbol16 *SymbolTable16;
801 const coff_symbol32 *SymbolTable32;
802 const char *StringTable;
803 uint32_t StringTableSize;
804 const coff_import_directory_table_entry *ImportDirectory;
805 const delay_import_directory_table_entry *DelayImportDirectory;
806 uint32_t NumberOfDelayImportDirectory;
807 const export_directory_table_entry *ExportDirectory;
808 const coff_base_reloc_block_header *BaseRelocHeader;
809 const coff_base_reloc_block_header *BaseRelocEnd;
810 const debug_directory *DebugDirectoryBegin;
811 const debug_directory *DebugDirectoryEnd;
812 const coff_tls_directory32 *TLSDirectory32;
813 const coff_tls_directory64 *TLSDirectory64;
814 // Either coff_load_configuration32 or coff_load_configuration64.
815 const void *LoadConfig = nullptr;
816
817 Expected<StringRef> getString(uint32_t offset) const;
818
819 template <typename coff_symbol_type>
820 const coff_symbol_type *toSymb(DataRefImpl Symb) const;
821 const coff_section *toSec(DataRefImpl Sec) const;
822 const coff_relocation *toRel(DataRefImpl Rel) const;
823
824 // Finish initializing the object and return success or an error.
826
827 Error initSymbolTablePtr();
828 Error initImportTablePtr();
829 Error initDelayImportTablePtr();
830 Error initExportTablePtr();
831 Error initBaseRelocPtr();
832 Error initDebugDirectoryPtr();
833 Error initTLSDirectoryPtr();
834 Error initLoadConfigPtr();
835
836public:
839
840 uintptr_t getSymbolTable() const {
841 if (SymbolTable16)
842 return reinterpret_cast<uintptr_t>(SymbolTable16);
843 if (SymbolTable32)
844 return reinterpret_cast<uintptr_t>(SymbolTable32);
845 return uintptr_t(0);
846 }
847
849 if (COFFHeader)
850 return COFFHeader->Machine;
851 if (COFFBigObjHeader)
852 return COFFBigObjHeader->Machine;
853 llvm_unreachable("no COFF header!");
854 }
855
857 if (COFFHeader)
858 return COFFHeader->isImportLibrary() ? 0
859 : COFFHeader->SizeOfOptionalHeader;
860 // bigobj doesn't have this field.
861 if (COFFBigObjHeader)
862 return 0;
863 llvm_unreachable("no COFF header!");
864 }
865
867 if (COFFHeader)
868 return COFFHeader->isImportLibrary() ? 0 : COFFHeader->Characteristics;
869 // bigobj doesn't have characteristics to speak of,
870 // editbin will silently lie to you if you attempt to set any.
871 if (COFFBigObjHeader)
872 return 0;
873 llvm_unreachable("no COFF header!");
874 }
875
877 if (COFFHeader)
878 return COFFHeader->TimeDateStamp;
879 if (COFFBigObjHeader)
880 return COFFBigObjHeader->TimeDateStamp;
881 llvm_unreachable("no COFF header!");
882 }
883
885 if (COFFHeader)
886 return COFFHeader->isImportLibrary() ? 0 : COFFHeader->NumberOfSections;
887 if (COFFBigObjHeader)
888 return COFFBigObjHeader->NumberOfSections;
889 llvm_unreachable("no COFF header!");
890 }
891
893 if (COFFHeader)
894 return COFFHeader->isImportLibrary() ? 0
895 : COFFHeader->PointerToSymbolTable;
896 if (COFFBigObjHeader)
897 return COFFBigObjHeader->PointerToSymbolTable;
898 llvm_unreachable("no COFF header!");
899 }
900
902 if (COFFHeader)
903 return COFFHeader->isImportLibrary() ? 0 : COFFHeader->NumberOfSymbols;
904 if (COFFBigObjHeader)
905 return COFFBigObjHeader->NumberOfSymbols;
906 llvm_unreachable("no COFF header!");
907 }
908
910 if (!SymbolTable16 && !SymbolTable32)
911 return 0;
912 return getRawNumberOfSymbols();
913 }
914
915 uint32_t getStringTableSize() const { return StringTableSize; }
916
918 return ExportDirectory;
919 }
920
922 assert(!is64());
923 return reinterpret_cast<const coff_load_configuration32 *>(LoadConfig);
924 }
925
927 assert(is64());
928 return reinterpret_cast<const coff_load_configuration64 *>(LoadConfig);
929 }
931
932protected:
933 void moveSymbolNext(DataRefImpl &Symb) const override;
934 Expected<StringRef> getSymbolName(DataRefImpl Symb) const override;
936 uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
937 uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
938 uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
939 Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
942 void moveSectionNext(DataRefImpl &Sec) const override;
944 uint64_t getSectionAddress(DataRefImpl Sec) const override;
945 uint64_t getSectionIndex(DataRefImpl Sec) const override;
946 uint64_t getSectionSize(DataRefImpl Sec) const override;
948 getSectionContents(DataRefImpl Sec) const override;
949 uint64_t getSectionAlignment(DataRefImpl Sec) const override;
950 bool isSectionCompressed(DataRefImpl Sec) const override;
951 bool isSectionText(DataRefImpl Sec) const override;
952 bool isSectionData(DataRefImpl Sec) const override;
953 bool isSectionBSS(DataRefImpl Sec) const override;
954 bool isSectionVirtual(DataRefImpl Sec) const override;
955 bool isDebugSection(DataRefImpl Sec) const override;
958
959 void moveRelocationNext(DataRefImpl &Rel) const override;
960 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
962 uint64_t getRelocationType(DataRefImpl Rel) const override;
964 SmallVectorImpl<char> &Result) const override;
965
966public:
967 basic_symbol_iterator symbol_begin() const override;
968 basic_symbol_iterator symbol_end() const override;
969 section_iterator section_begin() const override;
970 section_iterator section_end() const override;
971
972 bool is64Bit() const override { return false; }
973
974 const coff_section *getCOFFSection(const SectionRef &Section) const;
976 COFFSymbolRef getCOFFSymbol(const SymbolRef &Symbol) const;
977 const coff_relocation *getCOFFRelocation(const RelocationRef &Reloc) const;
978 unsigned getSectionID(SectionRef Sec) const;
979 unsigned getSymbolSectionID(SymbolRef Sym) const;
980
981 uint8_t getBytesInAddress() const override;
982 StringRef getFileFormatName() const override;
983 Triple::ArchType getArch() const override;
984 Expected<uint64_t> getStartAddress() const override;
986 return SubtargetFeatures();
987 }
988
998 return DebugDirectoryBegin;
999 }
1001 return DebugDirectoryEnd;
1002 }
1003
1011 }
1012
1014 return TLSDirectory32;
1015 }
1017 return TLSDirectory64;
1018 }
1019
1020 const dos_header *getDOSHeader() const {
1021 if (!PE32Header && !PE32PlusHeader)
1022 return nullptr;
1023 return reinterpret_cast<const dos_header *>(base());
1024 }
1025
1026 const coff_file_header *getCOFFHeader() const { return COFFHeader; }
1028 return COFFBigObjHeader;
1029 }
1030 const pe32_header *getPE32Header() const { return PE32Header; }
1031 const pe32plus_header *getPE32PlusHeader() const { return PE32PlusHeader; }
1032
1033 const data_directory *getDataDirectory(uint32_t index) const;
1034 Expected<const coff_section *> getSection(int32_t index) const;
1035
1037 if (index >= getNumberOfSymbols())
1039 if (SymbolTable16)
1040 return COFFSymbolRef(SymbolTable16 + index);
1041 if (SymbolTable32)
1042 return COFFSymbolRef(SymbolTable32 + index);
1044 }
1045
1046 template <typename T>
1047 Error getAuxSymbol(uint32_t index, const T *&Res) const {
1049 if (Error E = S.takeError())
1050 return E;
1051 Res = reinterpret_cast<const T *>(S->getRawPtr());
1052 return Error::success();
1053 }
1054
1057
1059
1061
1063 if (COFFHeader)
1064 return sizeof(coff_symbol16);
1065 if (COFFBigObjHeader)
1066 return sizeof(coff_symbol32);
1067 llvm_unreachable("null symbol table pointer!");
1068 }
1069
1071
1073 uint64_t getSectionSize(const coff_section *Sec) const;
1075 ArrayRef<uint8_t> &Res) const;
1076
1077 uint64_t getImageBase() const;
1078 Error getVaPtr(uint64_t VA, uintptr_t &Res) const;
1079 Error getRvaPtr(uint32_t Rva, uintptr_t &Res,
1080 const char *ErrorContext = nullptr) const;
1081
1082 /// Given an RVA base and size, returns a valid array of bytes or an error
1083 /// code if the RVA and size is not contained completely within a valid
1084 /// section.
1086 ArrayRef<uint8_t> &Contents,
1087 const char *ErrorContext = nullptr) const;
1088
1090 StringRef &Name) const;
1091
1092 /// Get PDB information out of a codeview debug directory entry.
1093 Error getDebugPDBInfo(const debug_directory *DebugDir,
1094 const codeview::DebugInfo *&Info,
1095 StringRef &PDBFileName) const;
1096
1097 /// Get PDB information from an executable. If the information is not present,
1098 /// Info will be set to nullptr and PDBFileName will be empty. An error is
1099 /// returned only on corrupt object files. Convenience accessor that can be
1100 /// used if the debug directory is not already handy.
1102 StringRef &PDBFileName) const;
1103
1104 bool isRelocatableObject() const override;
1105 bool is64() const { return PE32PlusHeader; }
1106
1108
1109 static bool classof(const Binary *v) { return v->isCOFF(); }
1110};
1111
1112// The iterator for the import directory table.
1114public:
1117 uint32_t I, const COFFObjectFile *Owner)
1118 : ImportTable(Table), Index(I), OwningObject(Owner) {}
1119
1120 bool operator==(const ImportDirectoryEntryRef &Other) const;
1121 void moveNext();
1122
1126
1130
1131 Error getName(StringRef &Result) const;
1132 Error getImportLookupTableRVA(uint32_t &Result) const;
1134
1135 Error
1137
1138private:
1139 const coff_import_directory_table_entry *ImportTable;
1141 const COFFObjectFile *OwningObject = nullptr;
1142};
1143
1145public:
1148 uint32_t I, const COFFObjectFile *Owner)
1149 : Table(T), Index(I), OwningObject(Owner) {}
1150
1152 void moveNext();
1153
1157
1158 Error getName(StringRef &Result) const;
1160 const delay_import_directory_table_entry *&Result) const;
1161 Error getImportAddress(int AddrIndex, uint64_t &Result) const;
1162
1163private:
1166 const COFFObjectFile *OwningObject = nullptr;
1167};
1168
1169// The iterator for the export directory table entry.
1171public:
1174 const COFFObjectFile *Owner)
1175 : ExportTable(Table), Index(I), OwningObject(Owner) {}
1176
1177 bool operator==(const ExportDirectoryEntryRef &Other) const;
1178 void moveNext();
1179
1180 Error getDllName(StringRef &Result) const;
1181 Error getOrdinalBase(uint32_t &Result) const;
1182 Error getOrdinal(uint32_t &Result) const;
1183 Error getExportRVA(uint32_t &Result) const;
1184 Error getSymbolName(StringRef &Result) const;
1185
1186 Error isForwarder(bool &Result) const;
1187 Error getForwardTo(StringRef &Result) const;
1188
1189private:
1190 const export_directory_table_entry *ExportTable;
1192 const COFFObjectFile *OwningObject = nullptr;
1193};
1194
1196public:
1199 const COFFObjectFile *Owner)
1200 : Entry32(Entry), Entry64(nullptr), Index(I), OwningObject(Owner) {}
1202 const COFFObjectFile *Owner)
1203 : Entry32(nullptr), Entry64(Entry), Index(I), OwningObject(Owner) {}
1204
1205 bool operator==(const ImportedSymbolRef &Other) const;
1206 void moveNext();
1207
1208 Error getSymbolName(StringRef &Result) const;
1209 Error isOrdinal(bool &Result) const;
1210 Error getOrdinal(uint16_t &Result) const;
1211 Error getHintNameRVA(uint32_t &Result) const;
1212
1213private:
1214 const import_lookup_table_entry32 *Entry32;
1215 const import_lookup_table_entry64 *Entry64;
1217 const COFFObjectFile *OwningObject = nullptr;
1218};
1219
1221public:
1222 BaseRelocRef() = default;
1224 const COFFObjectFile *Owner)
1225 : Header(Header), Index(0) {}
1226
1227 bool operator==(const BaseRelocRef &Other) const;
1228 void moveNext();
1229
1230 Error getType(uint8_t &Type) const;
1231 Error getRVA(uint32_t &Result) const;
1232
1233private:
1234 const coff_base_reloc_block_header *Header;
1236};
1237
1239public:
1241 explicit ResourceSectionRef(StringRef Ref) : BBS(Ref, support::little) {}
1242
1243 Error load(const COFFObjectFile *O);
1244 Error load(const COFFObjectFile *O, const SectionRef &S);
1245
1255
1257
1258private:
1259 BinaryByteStream BBS;
1260
1261 SectionRef Section;
1262 const COFFObjectFile *Obj;
1263
1264 std::vector<const coff_relocation *> Relocs;
1265
1268 getTableEntryAtOffset(uint32_t Offset);
1270 getDataEntryAtOffset(uint32_t Offset);
1271 Expected<ArrayRef<UTF16>> getDirStringAtOffset(uint32_t Offset);
1272};
1273
1274// Corresponds to `_FPO_DATA` structure in the PE/COFF spec.
1275struct FpoData {
1276 support::ulittle32_t Offset; // ulOffStart: Offset 1st byte of function code
1277 support::ulittle32_t Size; // cbProcSize: # bytes in function
1278 support::ulittle32_t NumLocals; // cdwLocals: # bytes in locals/4
1279 support::ulittle16_t NumParams; // cdwParams: # bytes in params/4
1281
1282 // cbProlog: # bytes in prolog
1283 int getPrologSize() const { return Attributes & 0xF; }
1284
1285 // cbRegs: # regs saved
1286 int getNumSavedRegs() const { return (Attributes >> 8) & 0x7; }
1287
1288 // fHasSEH: true if seh is func
1289 bool hasSEH() const { return (Attributes >> 9) & 1; }
1290
1291 // fUseBP: true if EBP has been allocated
1292 bool useBP() const { return (Attributes >> 10) & 1; }
1293
1294 // cbFrame: frame pointer
1295 frame_type getFP() const { return static_cast<frame_type>(Attributes >> 14); }
1296};
1297
1299 : public ErrorInfo<SectionStrippedError, BinaryError> {
1300public:
1302};
1303
1304} // end namespace object
1305
1306} // end namespace llvm
1307
1308#endif // LLVM_OBJECT_COFF_H
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")
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
Given that RA is a live value
std::string Name
uint64_t Size
#define I(x, y, z)
Definition: MD5.cpp:58
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
std::pair< llvm::MachO::Target, std::string > UUID
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
Base class for user error types.
Definition: Error.h:348
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
static ErrorSuccess success()
Create a success value.
Definition: Error.h:330
Tagged union holding either a T or a Error.
Definition: Error.h:470
Error takeError()
Take ownership of the stored error.
Definition: Error.h:597
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:577
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Manages the enabling and disabling of subtarget specific features.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
A range adaptor for a pair of iterators.
BaseRelocRef(const coff_base_reloc_block_header *Header, const COFFObjectFile *Owner)
Definition: COFF.h:1223
Error getType(uint8_t &Type) const
bool operator==(const BaseRelocRef &Other) const
Error getRVA(uint32_t &Result) const
bool isCOFF() const
Definition: Binary.h:130
const dos_header * getDOSHeader() const
Definition: COFF.h:1020
uint64_t getSectionSize(DataRefImpl Sec) const override
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
static bool classof(const Binary *v)
Definition: COFF.h:1109
uint64_t getSectionIndex(DataRefImpl Sec) const override
uint32_t getRawNumberOfSymbols() const
Definition: COFF.h:901
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
bool isSectionCompressed(DataRefImpl Sec) const override
const coff_tls_directory64 * getTLSDirectory64() const
Definition: COFF.h:1016
void moveRelocationNext(DataRefImpl &Rel) const override
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
export_directory_iterator export_directory_begin() const
delay_import_directory_iterator delay_import_directory_end() const
base_reloc_iterator base_reloc_begin() const
section_iterator section_end() const override
const pe32_header * getPE32Header() const
Definition: COFF.h:1030
Expected< COFFSymbolRef > getSymbol(uint32_t index) const
Definition: COFF.h:1036
Error getVaPtr(uint64_t VA, uintptr_t &Res) const
uint64_t getRelocationType(DataRefImpl Rel) const override
void moveSymbolNext(DataRefImpl &Symb) const override
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
iterator_range< delay_import_directory_iterator > delay_import_directories() const
const debug_directory * debug_directory_end() const
Definition: COFF.h:1000
import_directory_iterator import_directory_end() const
const coff_tls_directory32 * getTLSDirectory32() const
Definition: COFF.h:1013
Expected< SubtargetFeatures > getFeatures() const override
Definition: COFF.h:985
uint32_t getPointerToSymbolTable() const
Definition: COFF.h:892
const coff_relocation * getCOFFRelocation(const RelocationRef &Reloc) const
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
bool isDebugSection(DataRefImpl Sec) const override
iterator_range< const debug_directory * > debug_directories() const
Definition: COFF.h:1009
StringRef getRelocationTypeName(uint16_t Type) const
bool isSectionBSS(DataRefImpl Sec) const override
base_reloc_iterator base_reloc_end() const
uint64_t getSectionAddress(DataRefImpl Sec) const override
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
uint32_t getNumberOfSymbols() const
Definition: COFF.h:909
section_iterator section_begin() const override
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
const coff_file_header * getCOFFHeader() const
Definition: COFF.h:1026
size_t getSymbolTableEntrySize() const
Definition: COFF.h:1062
export_directory_iterator export_directory_end() const
Error getHintName(uint32_t Rva, uint16_t &Hint, StringRef &Name) const
Error getAuxSymbol(uint32_t index, const T *&Res) const
Definition: COFF.h:1047
uintptr_t getSymbolTable() const
Definition: COFF.h:840
static Expected< std::unique_ptr< COFFObjectFile > > create(MemoryBufferRef Object)
bool isSectionVirtual(DataRefImpl Sec) const override
unsigned getSectionID(SectionRef Sec) const
const coff_bigobj_file_header * getCOFFBigObjHeader() const
Definition: COFF.h:1027
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
iterator_range< import_directory_iterator > import_directories() const
delay_import_directory_iterator delay_import_directory_begin() const
basic_symbol_iterator symbol_end() const override
Error getRvaAndSizeAsBytes(uint32_t RVA, uint32_t Size, ArrayRef< uint8_t > &Contents, const char *ErrorContext=nullptr) const
Given an RVA base and size, returns a valid array of bytes or an error code if the RVA and size is no...
const coff_load_configuration64 * getLoadConfig64() const
Definition: COFF.h:926
iterator_range< export_directory_iterator > export_directories() const
uint32_t getNumberOfSections() const
Definition: COFF.h:884
uint64_t getRelocationOffset(DataRefImpl Rel) const override
basic_symbol_iterator symbol_begin() const override
uint32_t getTimeDateStamp() const
Definition: COFF.h:876
Triple::ArchType getArch() const override
uint32_t getStringTableSize() const
Definition: COFF.h:915
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
const debug_directory * debug_directory_begin() const
Definition: COFF.h:997
Expected< const coff_section * > getSection(int32_t index) const
bool isSectionText(DataRefImpl Sec) const override
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
const data_directory * getDataDirectory(uint32_t index) const
StringRef mapDebugSectionName(StringRef Name) const override
Maps a debug section name to a standard DWARF section name.
ArrayRef< uint8_t > getSymbolAuxData(COFFSymbolRef Symbol) const
const coff_load_configuration32 * getLoadConfig32() const
Definition: COFF.h:921
const coff_section * getCOFFSection(const SectionRef &Section) const
import_directory_iterator import_directory_begin() const
void moveSectionNext(DataRefImpl &Sec) const override
relocation_iterator section_rel_end(DataRefImpl Sec) const override
ArrayRef< coff_relocation > getRelocations(const coff_section *Sec) const
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
uint16_t getSizeOfOptionalHeader() const
Definition: COFF.h:856
Error getRvaPtr(uint32_t Rva, uintptr_t &Res, const char *ErrorContext=nullptr) const
uint16_t getCharacteristics() const
Definition: COFF.h:866
unsigned getSymbolSectionID(SymbolRef Sym) const
Error getDebugPDBInfo(const debug_directory *DebugDir, const codeview::DebugInfo *&Info, StringRef &PDBFileName) const
Get PDB information out of a codeview debug directory entry.
const pe32plus_header * getPE32PlusHeader() const
Definition: COFF.h:1031
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
uint64_t getSectionAlignment(DataRefImpl Sec) const override
uint32_t getSymbolIndex(COFFSymbolRef Symbol) const
uint16_t getMachine() const
Definition: COFF.h:848
COFFSymbolRef getCOFFSymbol(const DataRefImpl &Ref) const
const export_directory_table_entry * getExportTable() const
Definition: COFF.h:917
Expected< uint64_t > getStartAddress() const override
iterator_range< base_reloc_iterator > base_relocs() const
bool isSectionData(DataRefImpl Sec) const override
bool is64Bit() const override
Definition: COFF.h:972
StringRef getFileFormatName() const override
const void * getRawPtr() const
Definition: COFF.h:286
bool isCommon() const
Definition: COFF.h:381
const StringTableOffset & getStringTableOffset() const
Definition: COFF.h:312
uint8_t getStorageClass() const
Definition: COFF.h:338
uint16_t getType() const
Definition: COFF.h:333
const T * getAux() const
Definition: COFF.h:354
bool isAnyUndefined() const
Definition: COFF.h:405
bool isFileRecord() const
Definition: COFF.h:409
const coff_symbol_generic * getGeneric() const
Definition: COFF.h:290
const coff_aux_weak_external * getWeakExternal() const
Definition: COFF.h:366
bool isAbsolute() const
Definition: COFF.h:373
bool isSectionDefinition() const
Definition: COFF.h:417
uint8_t getComplexType() const
Definition: COFF.h:350
uint8_t getNumberOfAuxSymbols() const
Definition: COFF.h:343
bool isExternal() const
Definition: COFF.h:377
bool isFunctionLineInfo() const
Definition: COFF.h:401
uint8_t getBaseType() const
Definition: COFF.h:348
COFFSymbolRef(const coff_symbol32 *CS)
Definition: COFF.h:284
COFFSymbolRef(const coff_symbol16 *CS)
Definition: COFF.h:283
uint32_t getValue() const
Definition: COFF.h:317
const coff_aux_section_definition * getSectionDefinition() const
Definition: COFF.h:359
bool isWeakExternal() const
Definition: COFF.h:391
friend bool operator<(COFFSymbolRef A, COFFSymbolRef B)
Definition: COFF.h:296
const char * getShortName() const
Definition: COFF.h:308
bool isSection() const
Definition: COFF.h:413
int32_t getSectionNumber() const
Definition: COFF.h:322
bool isCLRToken() const
Definition: COFF.h:429
bool isBigObj() const
Definition: COFF.h:300
bool isUndefined() const
Definition: COFF.h:386
bool isFunctionDefinition() const
Definition: COFF.h:395
bool operator==(const DelayImportDirectoryEntryRef &Other) const
imported_symbol_iterator imported_symbol_begin() const
Error getImportAddress(int AddrIndex, uint64_t &Result) const
iterator_range< imported_symbol_iterator > imported_symbols() const
imported_symbol_iterator imported_symbol_end() const
Error getDelayImportTable(const delay_import_directory_table_entry *&Result) const
DelayImportDirectoryEntryRef(const delay_import_directory_table_entry *T, uint32_t I, const COFFObjectFile *Owner)
Definition: COFF.h:1147
Error getName(StringRef &Result) const
bool operator==(const ExportDirectoryEntryRef &Other) const
Error getDllName(StringRef &Result) const
ExportDirectoryEntryRef(const export_directory_table_entry *Table, uint32_t I, const COFFObjectFile *Owner)
Definition: COFF.h:1173
Error getExportRVA(uint32_t &Result) const
Error getOrdinalBase(uint32_t &Result) const
Error getOrdinal(uint32_t &Result) const
Error isForwarder(bool &Result) const
Error getForwardTo(StringRef &Result) const
Error getSymbolName(StringRef &Result) const
bool operator==(const ImportDirectoryEntryRef &Other) const
imported_symbol_iterator imported_symbol_end() const
imported_symbol_iterator imported_symbol_begin() const
Error getImportLookupTableRVA(uint32_t &Result) const
Error getImportTableEntry(const coff_import_directory_table_entry *&Result) const
imported_symbol_iterator lookup_table_end() const
ImportDirectoryEntryRef(const coff_import_directory_table_entry *Table, uint32_t I, const COFFObjectFile *Owner)
Definition: COFF.h:1116
iterator_range< imported_symbol_iterator > lookup_table_symbols() const
iterator_range< imported_symbol_iterator > imported_symbols() const
imported_symbol_iterator lookup_table_begin() const
Error getImportAddressTableRVA(uint32_t &Result) const
Error getName(StringRef &Result) const
bool operator==(const ImportedSymbolRef &Other) const
Error getHintNameRVA(uint32_t &Result) const
ImportedSymbolRef(const import_lookup_table_entry32 *Entry, uint32_t I, const COFFObjectFile *Owner)
Definition: COFF.h:1198
Error getOrdinal(uint16_t &Result) const
Error getSymbolName(StringRef &Result) const
ImportedSymbolRef(const import_lookup_table_entry64 *Entry, uint32_t I, const COFFObjectFile *Owner)
Definition: COFF.h:1201
Error isOrdinal(bool &Result) const
This class is the base class for all object file types.
Definition: ObjectFile.h:228
const uint8_t * base() const
Definition: ObjectFile.h:234
This is a value type class that represents a single relocation in the list of relocations in the obje...
Definition: ObjectFile.h:51
Expected< const coff_resource_dir_table & > getBaseTable()
Expected< const coff_resource_dir_table & > getEntrySubDir(const coff_resource_dir_entry &Entry)
Expected< const coff_resource_data_entry & > getEntryData(const coff_resource_dir_entry &Entry)
Error load(const COFFObjectFile *O)
ResourceSectionRef(StringRef Ref)
Definition: COFF.h:1241
Expected< ArrayRef< UTF16 > > getEntryNameString(const coff_resource_dir_entry &Entry)
Expected< StringRef > getContents(const coff_resource_data_entry &Entry)
Expected< const coff_resource_dir_entry & > getTableEntry(const coff_resource_dir_table &Table, uint32_t Index)
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:167
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_SCN_ALIGN_MASK
Definition: COFF.h:314
@ IMAGE_SCN_LNK_NRELOC_OVFL
Definition: COFF.h:315
@ IMAGE_SCN_TYPE_NO_PAD
Definition: COFF.h:287
@ NameSize
Definition: COFF.h:57
@ IMAGE_SYM_CLASS_SECTION
Line number, reformatted as symbol.
Definition: COFF.h:233
@ IMAGE_SYM_CLASS_FUNCTION
".bf" or ".ef" - beginning or end of function
Definition: COFF.h:229
@ IMAGE_SYM_CLASS_EXTERNAL
External symbol.
Definition: COFF.h:209
@ IMAGE_SYM_CLASS_FILE
File name.
Definition: COFF.h:231
@ IMAGE_SYM_CLASS_CLR_TOKEN
External symbol in dmert public lib.
Definition: COFF.h:236
@ IMAGE_SYM_CLASS_WEAK_EXTERNAL
Duplicate tag.
Definition: COFF.h:234
@ IMAGE_SYM_CLASS_STATIC
Static.
Definition: COFF.h:210
const int32_t MaxNumberOfSections16
Definition: COFF.h:32
bool isReservedSectionNumber(int32_t SectionNumber)
Definition: COFF.h:792
@ IMAGE_SYM_TYPE_NULL
No type information or unknown base type.
Definition: COFF.h:240
@ IMAGE_SYM_UNDEFINED
Definition: COFF.h:199
@ IMAGE_SYM_ABSOLUTE
Definition: COFF.h:198
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
Definition: COFF.h:261
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
Definition: COFF.h:265
coff_symbol< support::ulittle32_t > coff_symbol32
Definition: COFF.h:266
coff_symbol< support::ulittle16_t > coff_symbol16
Definition: COFF.h:265
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:270
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:272
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:406
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Definition: MathExtras.h:373
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition: MathExtras.h:288
@ Ref
The access may reference the value stored in memory.
ArrayRef(const T &OneElt) -> ArrayRef< T >
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition: Error.cpp:92
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
support::ulittle32_t NumLocals
Definition: COFF.h:1278
bool hasSEH() const
Definition: COFF.h:1289
bool useBP() const
Definition: COFF.h:1292
int getNumSavedRegs() const
Definition: COFF.h:1286
support::ulittle32_t Size
Definition: COFF.h:1277
int getPrologSize() const
Definition: COFF.h:1283
frame_type getFP() const
Definition: COFF.h:1295
support::ulittle16_t NumParams
Definition: COFF.h:1279
support::ulittle16_t Attributes
Definition: COFF.h:1280
support::ulittle32_t Offset
Definition: COFF.h:1276
support::ulittle32_t Offset
Definition: COFF.h:246
support::ulittle32_t Zeroes
Definition: COFF.h:245
support::ulittle32_t PointerToNextFunction
Definition: COFF.h:495
support::ulittle16_t Linenumber
Definition: COFF.h:493
support::ulittle32_t SymbolTableIndex
Definition: COFF.h:534
support::ulittle32_t PointerToLinenumber
Definition: COFF.h:483
support::ulittle32_t TotalSize
Definition: COFF.h:482
support::ulittle32_t PointerToNextFunction
Definition: COFF.h:484
support::ulittle16_t NumberOfLinenumbers
Definition: COFF.h:514
support::ulittle32_t CheckSum
Definition: COFF.h:515
int32_t getNumber(bool IsBigObj) const
Definition: COFF.h:520
support::ulittle16_t NumberHighPart
Definition: COFF.h:519
support::ulittle16_t NumberLowPart
Definition: COFF.h:516
support::ulittle16_t NumberOfRelocations
Definition: COFF.h:513
support::ulittle32_t Characteristics
Definition: COFF.h:504
support::ulittle32_t TagIndex
Definition: COFF.h:503
Definition: COFF.h:736
support::ulittle16_t Data
Definition: COFF.h:737
int getOffset() const
Definition: COFF.h:740
int getType() const
Definition: COFF.h:739
support::ulittle32_t BlockSize
Definition: COFF.h:733
support::ulittle32_t unused2
Definition: COFF.h:95
support::ulittle16_t Version
Definition: COFF.h:90
support::ulittle32_t PointerToSymbolTable
Definition: COFF.h:99
support::ulittle32_t unused1
Definition: COFF.h:94
support::ulittle16_t Sig1
Definition: COFF.h:88
support::ulittle32_t NumberOfSections
Definition: COFF.h:98
support::ulittle16_t Machine
Definition: COFF.h:91
support::ulittle32_t unused4
Definition: COFF.h:97
support::ulittle32_t unused3
Definition: COFF.h:96
support::ulittle32_t TimeDateStamp
Definition: COFF.h:92
support::ulittle16_t Sig2
Definition: COFF.h:89
support::ulittle32_t NumberOfSymbols
Definition: COFF.h:100
support::ulittle16_t Machine
Definition: COFF.h:76
support::ulittle32_t NumberOfSymbols
Definition: COFF.h:80
support::ulittle16_t Characteristics
Definition: COFF.h:82
support::ulittle32_t PointerToSymbolTable
Definition: COFF.h:79
support::ulittle16_t NumberOfSections
Definition: COFF.h:77
bool isImportLibrary() const
Definition: COFF.h:84
support::ulittle16_t SizeOfOptionalHeader
Definition: COFF.h:81
support::ulittle32_t TimeDateStamp
Definition: COFF.h:78
Definition: COFF.h:555
support::ulittle32_t TimeDateStamp
Definition: COFF.h:557
support::ulittle32_t ImportAddressTableRVA
Definition: COFF.h:560
support::ulittle32_t ForwarderChain
Definition: COFF.h:558
bool isNull() const
Definition: COFF.h:562
support::ulittle32_t NameRVA
Definition: COFF.h:559
support::ulittle32_t ImportLookupTableRVA
Definition: COFF.h:556
support::ulittle16_t TypeInfo
Definition: COFF.h:549
support::ulittle16_t Machine
Definition: COFF.h:545
support::ulittle32_t SizeOfData
Definition: COFF.h:547
support::ulittle16_t Sig2
Definition: COFF.h:543
support::ulittle16_t OrdinalHint
Definition: COFF.h:548
support::ulittle32_t TimeDateStamp
Definition: COFF.h:546
support::ulittle16_t Version
Definition: COFF.h:544
support::ulittle16_t Sig1
Definition: COFF.h:542
32-bit load config (IMAGE_LOAD_CONFIG_DIRECTORY32)
Definition: COFF.h:610
support::ulittle16_t MinorVersion
Definition: COFF.h:614
support::ulittle32_t SEHandlerCount
Definition: COFF.h:630
support::ulittle32_t GuardAddressTakenIatEntryCount
Definition: COFF.h:642
support::ulittle32_t GuardRFFailureRoutineFunctionPointer
Definition: COFF.h:648
support::ulittle32_t DynamicValueRelocTable
Definition: COFF.h:645
support::ulittle32_t GuardCFCheckFunction
Definition: COFF.h:633
support::ulittle32_t GuardRFVerifyStackPointerFunctionPointer
Definition: COFF.h:652
support::ulittle32_t GuardEHContinuationTable
Definition: COFF.h:659
support::ulittle32_t Size
Definition: COFF.h:611
support::ulittle32_t SEHandlerTable
Definition: COFF.h:629
support::ulittle32_t LockPrefixTable
Definition: COFF.h:620
support::ulittle16_t CSDVersion
Definition: COFF.h:625
support::ulittle16_t Reserved2
Definition: COFF.h:651
support::ulittle32_t CHPEMetadataPointer
Definition: COFF.h:646
support::ulittle32_t VirtualMemoryThreshold
Definition: COFF.h:622
support::ulittle32_t GuardCFFunctionCount
Definition: COFF.h:636
support::ulittle32_t DeCommitFreeBlockThreshold
Definition: COFF.h:618
support::ulittle32_t ProcessAffinityMask
Definition: COFF.h:623
support::ulittle32_t MaximumAllocationSize
Definition: COFF.h:621
support::ulittle32_t EnclaveConfigurationPointer
Definition: COFF.h:657
support::ulittle16_t DependentLoadFlags
Definition: COFF.h:626
support::ulittle32_t TimeDateStamp
Definition: COFF.h:612
support::ulittle32_t GuardXFGCheckFunctionPointer
Definition: COFF.h:661
support::ulittle32_t GuardCFCheckDispatch
Definition: COFF.h:634
support::ulittle32_t GuardLongJumpTargetCount
Definition: COFF.h:644
support::ulittle32_t GuardLongJumpTargetTable
Definition: COFF.h:643
support::ulittle32_t Reserved3
Definition: COFF.h:656
support::ulittle32_t GuardAddressTakenIatEntryTable
Definition: COFF.h:641
support::ulittle32_t CriticalSectionDefaultTimeout
Definition: COFF.h:617
support::ulittle32_t GuardEHContinuationCount
Definition: COFF.h:660
support::ulittle16_t DynamicValueRelocTableSection
Definition: COFF.h:650
support::ulittle32_t GuardXFGTableDispatchFunctionPointer
Definition: COFF.h:663
support::ulittle32_t GuardCFFunctionTable
Definition: COFF.h:635
support::ulittle32_t GuardFlags
Definition: COFF.h:637
support::ulittle32_t SecurityCookie
Definition: COFF.h:628
support::ulittle32_t HotPatchTableOffset
Definition: COFF.h:653
coff_load_config_code_integrity CodeIntegrity
Definition: COFF.h:640
support::ulittle16_t MajorVersion
Definition: COFF.h:613
support::ulittle32_t ProcessHeapFlags
Definition: COFF.h:624
support::ulittle32_t GuardXFGDispatchFunctionPointer
Definition: COFF.h:662
support::ulittle32_t GuardRFFailureRoutine
Definition: COFF.h:647
support::ulittle32_t DynamicValueRelocTableOffset
Definition: COFF.h:649
support::ulittle32_t DeCommitTotalFreeThreshold
Definition: COFF.h:619
support::ulittle32_t GlobalFlagsSet
Definition: COFF.h:616
support::ulittle32_t EditList
Definition: COFF.h:627
support::ulittle32_t GlobalFlagsClear
Definition: COFF.h:615
support::ulittle32_t CastGuardOsDeterminedFailureMode
Definition: COFF.h:664
support::ulittle32_t VolatileMetadataPointer
Definition: COFF.h:658
64-bit load config (IMAGE_LOAD_CONFIG_DIRECTORY64)
Definition: COFF.h:668
support::ulittle64_t VirtualMemoryThreshold
Definition: COFF.h:680
support::ulittle32_t TimeDateStamp
Definition: COFF.h:670
support::ulittle64_t GuardCFFunctionCount
Definition: COFF.h:694
support::ulittle32_t GuardFlags
Definition: COFF.h:695
support::ulittle64_t VolatileMetadataPointer
Definition: COFF.h:716
support::ulittle16_t MinorVersion
Definition: COFF.h:672
support::ulittle16_t MajorVersion
Definition: COFF.h:671
support::ulittle64_t GuardRFFailureRoutineFunctionPointer
Definition: COFF.h:706
support::ulittle32_t DynamicValueRelocTableOffset
Definition: COFF.h:707
support::ulittle16_t DependentLoadFlags
Definition: COFF.h:684
support::ulittle16_t Reserved2
Definition: COFF.h:709
support::ulittle32_t GlobalFlagsSet
Definition: COFF.h:674
support::ulittle64_t GuardAddressTakenIatEntryTable
Definition: COFF.h:699
support::ulittle64_t EditList
Definition: COFF.h:685
support::ulittle64_t DeCommitFreeBlockThreshold
Definition: COFF.h:676
support::ulittle64_t GuardXFGCheckFunctionPointer
Definition: COFF.h:719
coff_load_config_code_integrity CodeIntegrity
Definition: COFF.h:698
support::ulittle64_t DynamicValueRelocTable
Definition: COFF.h:703
support::ulittle64_t ProcessAffinityMask
Definition: COFF.h:681
support::ulittle64_t DeCommitTotalFreeThreshold
Definition: COFF.h:677
support::ulittle64_t GuardAddressTakenIatEntryCount
Definition: COFF.h:700
support::ulittle64_t GuardEHContinuationCount
Definition: COFF.h:718
support::ulittle64_t GuardRFFailureRoutine
Definition: COFF.h:705
support::ulittle32_t CriticalSectionDefaultTimeout
Definition: COFF.h:675
support::ulittle64_t GuardCFFunctionTable
Definition: COFF.h:693
support::ulittle64_t GuardLongJumpTargetTable
Definition: COFF.h:701
support::ulittle64_t SEHandlerTable
Definition: COFF.h:687
support::ulittle64_t MaximumAllocationSize
Definition: COFF.h:679
support::ulittle64_t SEHandlerCount
Definition: COFF.h:688
support::ulittle64_t GuardCFCheckFunction
Definition: COFF.h:691
support::ulittle32_t Reserved3
Definition: COFF.h:714
support::ulittle32_t HotPatchTableOffset
Definition: COFF.h:711
support::ulittle64_t GuardCFCheckDispatch
Definition: COFF.h:692
support::ulittle64_t GuardXFGTableDispatchFunctionPointer
Definition: COFF.h:721
support::ulittle64_t SecurityCookie
Definition: COFF.h:686
support::ulittle64_t GuardEHContinuationTable
Definition: COFF.h:717
support::ulittle64_t LockPrefixTable
Definition: COFF.h:678
support::ulittle16_t CSDVersion
Definition: COFF.h:683
support::ulittle64_t CastGuardOsDeterminedFailureMode
Definition: COFF.h:722
support::ulittle32_t GlobalFlagsClear
Definition: COFF.h:673
support::ulittle32_t ProcessHeapFlags
Definition: COFF.h:682
support::ulittle16_t DynamicValueRelocTableSection
Definition: COFF.h:708
support::ulittle64_t CHPEMetadataPointer
Definition: COFF.h:704
support::ulittle64_t GuardXFGDispatchFunctionPointer
Definition: COFF.h:720
support::ulittle64_t GuardRFVerifyStackPointerFunctionPointer
Definition: COFF.h:710
support::ulittle64_t GuardLongJumpTargetCount
Definition: COFF.h:702
support::ulittle64_t EnclaveConfigurationPointer
Definition: COFF.h:715
support::ulittle32_t Size
Definition: COFF.h:669
support::ulittle16_t Type
Definition: COFF.h:477
support::ulittle32_t SymbolTableIndex
Definition: COFF.h:476
support::ulittle32_t VirtualAddress
Definition: COFF.h:475
Definition: COFF.h:766
support::ulittle32_t Reserved
Definition: COFF.h:770
support::ulittle32_t DataSize
Definition: COFF.h:768
support::ulittle32_t Codepage
Definition: COFF.h:769
support::ulittle32_t DataRVA
Definition: COFF.h:767
Definition: COFF.h:743
support::ulittle32_t NameOffset
Definition: COFF.h:745
union llvm::object::coff_resource_dir_entry::@333 Offset
union llvm::object::coff_resource_dir_entry::@332 Identifier
support::ulittle32_t DataEntryOffset
Definition: COFF.h:755
support::ulittle32_t ID
Definition: COFF.h:746
support::ulittle32_t SubdirOffset
Definition: COFF.h:756
support::ulittle16_t NumberOfNameEntries
Definition: COFF.h:778
support::ulittle32_t Characteristics
Definition: COFF.h:774
support::ulittle16_t NumberOfIDEntries
Definition: COFF.h:779
support::ulittle32_t TimeDateStamp
Definition: COFF.h:775
support::ulittle16_t MinorVersion
Definition: COFF.h:777
support::ulittle16_t MajorVersion
Definition: COFF.h:776
support::ulittle32_t BeginAddress
Definition: COFF.h:726
support::ulittle32_t UnwindInformation
Definition: COFF.h:728
support::ulittle32_t EndAddress
Definition: COFF.h:727
support::ulittle32_t PointerToRawData
Definition: COFF.h:445
char Name[COFF::NameSize]
Definition: COFF.h:441
support::ulittle32_t VirtualSize
Definition: COFF.h:442
bool hasExtendedRelocations() const
Definition: COFF.h:454
uint32_t getAlignment() const
Definition: COFF.h:459
support::ulittle32_t Characteristics
Definition: COFF.h:450
support::ulittle16_t NumberOfLinenumbers
Definition: COFF.h:449
support::ulittle32_t SizeOfRawData
Definition: COFF.h:444
support::ulittle32_t VirtualAddress
Definition: COFF.h:443
support::ulittle32_t PointerToRelocations
Definition: COFF.h:446
support::ulittle16_t NumberOfRelocations
Definition: COFF.h:448
support::ulittle32_t PointerToLinenumbers
Definition: COFF.h:447
union llvm::object::coff_symbol_generic::@331 Name
support::ulittle32_t Value
Definition: COFF.h:274
StringTableOffset Offset
Definition: COFF.h:272
char ShortName[COFF::NameSize]
Definition: COFF.h:271
StringTableOffset Offset
Definition: COFF.h:253
SectionNumberType SectionNumber
Definition: COFF.h:257
support::ulittle32_t Value
Definition: COFF.h:256
char ShortName[COFF::NameSize]
Definition: COFF.h:252
union llvm::object::coff_symbol::@330 Name
support::ulittle16_t Type
Definition: COFF.h:259
uint8_t NumberOfAuxSymbols
Definition: COFF.h:262
support::ulittle32_t SizeOfZeroFill
Definition: COFF.h:574
uint32_t getAlignment() const
Definition: COFF.h:577
support::ulittle32_t Characteristics
Definition: COFF.h:575
void setAlignment(uint32_t Align)
Definition: COFF.h:585
support::ulittle32_t RelativeVirtualAddress
Definition: COFF.h:173
support::ulittle32_t Size
Definition: COFF.h:174
support::ulittle16_t MajorVersion
Definition: COFF.h:180
support::ulittle32_t SizeOfData
Definition: COFF.h:183
support::ulittle32_t PointerToRawData
Definition: COFF.h:185
support::ulittle32_t AddressOfRawData
Definition: COFF.h:184
support::ulittle32_t TimeDateStamp
Definition: COFF.h:179
support::ulittle32_t Type
Definition: COFF.h:182
support::ulittle32_t Characteristics
Definition: COFF.h:178
support::ulittle16_t MinorVersion
Definition: COFF.h:181
support::ulittle16_t HashAlgorithm
Definition: COFF.h:785
support::ulittle16_t Version
Definition: COFF.h:784
support::ulittle32_t Magic
Definition: COFF.h:783
Definition: COFF.h:210
support::ulittle32_t DelayImportNameTable
Definition: COFF.h:216
support::ulittle32_t DelayImportAddressTable
Definition: COFF.h:215
support::ulittle32_t Name
Definition: COFF.h:213
support::ulittle32_t UnloadDelayImportTable
Definition: COFF.h:218
support::ulittle32_t BoundDelayImportTable
Definition: COFF.h:217
support::ulittle32_t TimeStamp
Definition: COFF.h:219
support::ulittle32_t Attributes
Definition: COFF.h:212
support::ulittle32_t ModuleHandle
Definition: COFF.h:214
The DOS compatible header at the front of all PE/COFF executables.
Definition: COFF.h:53
support::ulittle16_t AddressOfRelocationTable
Definition: COFF.h:66
support::ulittle16_t NumberOfRelocationItems
Definition: COFF.h:57
support::ulittle16_t InitialSP
Definition: COFF.h:62
support::ulittle16_t HeaderSizeInParagraphs
Definition: COFF.h:58
support::ulittle16_t InitialIP
Definition: COFF.h:64
support::ulittle32_t AddressOfNewExeHeader
Definition: COFF.h:72
support::ulittle16_t MaximumExtraParagraphs
Definition: COFF.h:60
support::ulittle16_t InitialRelativeSS
Definition: COFF.h:61
support::ulittle16_t OEMid
Definition: COFF.h:69
support::ulittle16_t OverlayNumber
Definition: COFF.h:67
support::ulittle16_t UsedBytesInTheLastPage
Definition: COFF.h:55
support::ulittle16_t Reserved[4]
Definition: COFF.h:68
support::ulittle16_t Checksum
Definition: COFF.h:63
support::ulittle16_t FileSizeInPages
Definition: COFF.h:56
support::ulittle16_t OEMinfo
Definition: COFF.h:70
support::ulittle16_t InitialRelativeCS
Definition: COFF.h:65
support::ulittle16_t Reserved2[10]
Definition: COFF.h:71
support::ulittle16_t MinimumExtraParagraphs
Definition: COFF.h:59
Definition: COFF.h:222
support::ulittle32_t OrdinalBase
Definition: COFF.h:228
support::ulittle32_t ExportAddressTableRVA
Definition: COFF.h:231
support::ulittle32_t NameRVA
Definition: COFF.h:227
support::ulittle32_t NumberOfNamePointers
Definition: COFF.h:230
support::ulittle32_t NamePointerRVA
Definition: COFF.h:232
support::ulittle32_t ExportFlags
Definition: COFF.h:223
support::ulittle32_t AddressTableEntries
Definition: COFF.h:229
support::ulittle16_t MinorVersion
Definition: COFF.h:226
support::ulittle16_t MajorVersion
Definition: COFF.h:225
support::ulittle32_t TimeDateStamp
Definition: COFF.h:224
support::ulittle32_t OrdinalTableRVA
Definition: COFF.h:233
Definition: COFF.h:189
bool isOrdinal() const
Definition: COFF.h:192
uint32_t getHintNameRVA() const
Definition: COFF.h:199
IntTy Data
Definition: COFF.h:190
uint16_t getOrdinal() const
Definition: COFF.h:194
The 32-bit PE header that follows the COFF header.
Definition: COFF.h:104
support::ulittle16_t MajorImageVersion
Definition: COFF.h:119
support::ulittle16_t Subsystem
Definition: COFF.h:127
support::ulittle16_t MinorImageVersion
Definition: COFF.h:120
support::ulittle16_t DLLCharacteristics
Definition: COFF.h:129
support::ulittle32_t CheckSum
Definition: COFF.h:126
uint8_t MinorLinkerVersion
Definition: COFF.h:107
support::ulittle32_t SizeOfStackCommit
Definition: COFF.h:131
support::ulittle32_t SizeOfStackReserve
Definition: COFF.h:130
support::ulittle32_t NumberOfRvaAndSize
Definition: COFF.h:136
support::ulittle16_t MinorOperatingSystemVersion
Definition: COFF.h:118
support::ulittle32_t SectionAlignment
Definition: COFF.h:115
support::ulittle32_t SizeOfInitializedData
Definition: COFF.h:109
support::ulittle32_t SizeOfHeapCommit
Definition: COFF.h:133
support::ulittle32_t AddressOfEntryPoint
Definition: COFF.h:111
support::ulittle32_t Win32VersionValue
Definition: COFF.h:123
support::ulittle16_t MinorSubsystemVersion
Definition: COFF.h:122
support::ulittle16_t Magic
Definition: COFF.h:105
support::ulittle32_t BaseOfData
Definition: COFF.h:113
support::ulittle32_t SizeOfImage
Definition: COFF.h:124
support::ulittle32_t BaseOfCode
Definition: COFF.h:112
support::ulittle32_t ImageBase
Definition: COFF.h:114
support::ulittle16_t MajorOperatingSystemVersion
Definition: COFF.h:117
support::ulittle32_t SizeOfHeaders
Definition: COFF.h:125
support::ulittle32_t SizeOfUninitializedData
Definition: COFF.h:110
uint8_t MajorLinkerVersion
Definition: COFF.h:106
support::ulittle32_t FileAlignment
Definition: COFF.h:116
support::ulittle16_t MajorSubsystemVersion
Definition: COFF.h:121
support::ulittle32_t SizeOfCode
Definition: COFF.h:108
support::ulittle32_t SizeOfHeapReserve
Definition: COFF.h:132
support::ulittle32_t LoaderFlags
Definition: COFF.h:134
The 64-bit PE header that follows the COFF header.
Definition: COFF.h:140
support::ulittle16_t MinorOperatingSystemVersion
Definition: COFF.h:153
support::ulittle32_t SizeOfImage
Definition: COFF.h:159
support::ulittle32_t SizeOfCode
Definition: COFF.h:144
support::ulittle16_t MajorImageVersion
Definition: COFF.h:154
support::ulittle32_t SizeOfHeaders
Definition: COFF.h:160
support::ulittle32_t CheckSum
Definition: COFF.h:161
support::ulittle64_t SizeOfStackCommit
Definition: COFF.h:165
support::ulittle32_t SizeOfInitializedData
Definition: COFF.h:145
support::ulittle32_t Win32VersionValue
Definition: COFF.h:158
support::ulittle16_t MajorOperatingSystemVersion
Definition: COFF.h:152
support::ulittle16_t MajorSubsystemVersion
Definition: COFF.h:156
support::ulittle32_t LoaderFlags
Definition: COFF.h:168
support::ulittle16_t MinorImageVersion
Definition: COFF.h:155
support::ulittle32_t AddressOfEntryPoint
Definition: COFF.h:147
support::ulittle16_t MinorSubsystemVersion
Definition: COFF.h:157
support::ulittle32_t FileAlignment
Definition: COFF.h:151
support::ulittle64_t ImageBase
Definition: COFF.h:149
support::ulittle16_t Subsystem
Definition: COFF.h:162
support::ulittle16_t Magic
Definition: COFF.h:141
support::ulittle32_t SizeOfUninitializedData
Definition: COFF.h:146
support::ulittle32_t NumberOfRvaAndSize
Definition: COFF.h:169
support::ulittle32_t BaseOfCode
Definition: COFF.h:148
support::ulittle32_t SectionAlignment
Definition: COFF.h:150
support::ulittle64_t SizeOfHeapReserve
Definition: COFF.h:166
support::ulittle64_t SizeOfStackReserve
Definition: COFF.h:164
support::ulittle16_t DLLCharacteristics
Definition: COFF.h:163
support::ulittle64_t SizeOfHeapCommit
Definition: COFF.h:167
Definition: COFF.h:236
support::ulittle32_t ExportRVA
Definition: COFF.h:237
support::ulittle32_t ForwarderRVA
Definition: COFF.h:238