22#ifndef LLVM_BINARYFORMAT_COFF_H
23#define LLVM_BINARYFORMAT_COFF_H
35static const char PEMagic[] = {
'P',
'E',
'\0',
'\0'};
38 '\xc7',
'\xa1',
'\xba',
'\xd1',
'\xee',
'\xba',
'\xa9',
'\x4b',
39 '\xaf',
'\x20',
'\xfa',
'\xf6',
'\x6a',
'\xa4',
'\xdc',
'\xb8',
43 '\x38',
'\xfe',
'\xb3',
'\x0c',
'\xa5',
'\xd9',
'\xab',
'\x4d',
44 '\xac',
'\x9b',
'\xd6',
'\xb6',
'\x22',
'\x26',
'\x53',
'\xc2',
49 '\x00',
'\x00',
'\x00',
'\x00',
'\x20',
'\x00',
'\x00',
'\x00',
50 '\xff',
'\xff',
'\x00',
'\x00',
'\xff',
'\xff',
'\x00',
'\x00',
527 return data & 0xFFFF;
831 return SectionNumber <= 0;
COFF::MachineTypes Machine
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::pair< llvm::MachO::Target, std::string > UUID
static const char ClGlObjMagic[]
@ IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE
Terminal Server aware.
@ IMAGE_DLL_CHARACTERISTICS_GUARD_CF
@ IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION
Isolation aware, but do not isolate the image.
@ IMAGE_DLL_CHARACTERISTICS_NX_COMPAT
@ IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER
Image supports Control Flow Guard.
@ IMAGE_DLL_CHARACTERISTICS_NO_BIND
Do not bind the image.
@ IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY
Code integrity checks are enforced.
@ IMAGE_DLL_CHARACTERISTICS_APPCONTAINER
A WDM driver.
@ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
DLL can be relocated at load time.
@ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
ASLR with 64 bit address space.
@ IMAGE_DLL_CHARACTERISTICS_NO_SEH
Does not use structured exception handling (SEH).
@ IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF
@ IMAGE_REL_BASED_MIPS_JMPADDR16
@ IMAGE_REL_BASED_ARM_MOV32T
@ IMAGE_REL_BASED_ABSOLUTE
@ IMAGE_REL_BASED_MIPS_JMPADDR
@ IMAGE_REL_BASED_HIGHLOW
@ IMAGE_REL_BASED_HIGHADJ
@ IMAGE_REL_BASED_ARM_MOV32A
@ IMAGE_DYNAMIC_RELOCATION_ARM64X
@ IMAGE_DYNAMIC_RELOCATION_GUARD_SWITCHTABLE_BRANCH
@ IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE
@ IMAGE_DYNAMIC_RELOCATION_GUARD_INDIR_CONTROL_TRANSFER
@ IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER
@ IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE
@ IMAGE_FILE_MACHINE_WCEMIPSV2
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_IA64
@ IMAGE_FILE_MACHINE_POWERPCFP
@ IMAGE_FILE_MACHINE_POWERPC
@ IMAGE_FILE_MACHINE_UNKNOWN
@ IMAGE_FILE_MACHINE_MIPS16
@ IMAGE_FILE_MACHINE_THUMB
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_ARM64EC
@ IMAGE_FILE_MACHINE_MIPSFPU16
@ IMAGE_FILE_MACHINE_AM33
@ IMAGE_FILE_MACHINE_R4000
@ IMAGE_FILE_MACHINE_M32R
@ IMAGE_FILE_MACHINE_MIPSFPU
@ IMAGE_FILE_MACHINE_RISCV64
@ IMAGE_FILE_MACHINE_RISCV32
@ IMAGE_FILE_MACHINE_SH3DSP
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_RISCV128
@ IMAGE_FILE_MACHINE_ARM64X
@ IMAGE_FILE_MACHINE_ARMNT
@ IMAGE_SCN_ALIGN_64BYTES
@ IMAGE_SCN_ALIGN_128BYTES
@ IMAGE_SCN_MEM_NOT_PAGED
@ IMAGE_SCN_ALIGN_256BYTES
@ IMAGE_SCN_ALIGN_1024BYTES
@ IMAGE_SCN_MEM_NOT_CACHED
@ IMAGE_SCN_ALIGN_512BYTES
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
@ IMAGE_SCN_MEM_DISCARDABLE
@ IMAGE_SCN_ALIGN_4096BYTES
@ IMAGE_SCN_CNT_INITIALIZED_DATA
@ IMAGE_SCN_ALIGN_8192BYTES
@ IMAGE_SCN_LNK_NRELOC_OVFL
@ IMAGE_SCN_ALIGN_16BYTES
@ IMAGE_SCN_MEM_PURGEABLE
@ IMAGE_SCN_ALIGN_32BYTES
@ IMAGE_SCN_ALIGN_2048BYTES
bool isAnyArm64(T Machine)
@ IMAGE_DEBUG_TYPE_OMAP_FROM_SRC
@ IMAGE_DEBUG_TYPE_BORLAND
@ IMAGE_DEBUG_TYPE_VC_FEATURE
@ IMAGE_DEBUG_TYPE_CODEVIEW
@ IMAGE_DEBUG_TYPE_OMAP_TO_SRC
@ IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS
@ IMAGE_DEBUG_TYPE_UNKNOWN
@ IMAGE_DEBUG_TYPE_EXCEPTION
@ IMAGE_DEBUG_TYPE_RESERVED10
@ IMAGE_REL_ARM64_BRANCH19
@ IMAGE_REL_ARM64_SECREL_LOW12A
@ IMAGE_REL_ARM64_SECTION
@ IMAGE_REL_ARM64_SECREL_HIGH12A
@ IMAGE_REL_ARM64_ABSOLUTE
@ IMAGE_REL_ARM64_PAGEOFFSET_12A
@ IMAGE_REL_ARM64_BRANCH14
@ IMAGE_REL_ARM64_BRANCH26
@ IMAGE_REL_ARM64_PAGEOFFSET_12L
@ IMAGE_REL_ARM64_SECREL_LOW12L
@ IMAGE_REL_ARM64_ADDR32NB
@ IMAGE_REL_ARM64_PAGEBASE_REL21
@ CF_FUNCTION_TABLE_SIZE_5BYTES
@ CF_FUNCTION_TABLE_SIZE_7BYTES
@ CF_FUNCTION_TABLE_SIZE_17BYTES
@ PROTECT_DELAYLOAD_IAT
Module supports read only delay load IAT.
@ CF_FUNCTION_TABLE_SIZE_6BYTES
@ DELAYLOAD_IAT_IN_ITS_OWN_SECTION
Delayload import table in its own .didat section (with nothing else in it) that can be freely reprote...
@ CF_EXPORT_SUPPRESSION_INFO_PRESENT
Module contains suppressed export information.
@ CF_INSTRUMENTED
Module performs control flow integrity checks using system-supplied support.
@ EH_CONTINUATION_TABLE_PRESENT
Module contains EH continuation target information.
@ CF_FUNCTION_TABLE_SIZE_18BYTES
@ CF_FUNCTION_TABLE_SIZE_19BYTES
@ CF_FUNCTION_TABLE_SIZE_15BYTES
@ CF_FUNCTION_TABLE_SIZE_MASK
Mask for the subfield that contains the stride of Control Flow Guard function table entries (that is,...
@ CF_FUNCTION_TABLE_SIZE_13BYTES
@ CF_LONGJUMP_TABLE_PRESENT
Module contains longjmp target information.
@ CF_FUNCTION_TABLE_SIZE_8BYTES
@ CF_FUNCTION_TABLE_PRESENT
Module contains valid control flow target metadata.
@ SECURITY_COOKIE_UNUSED
Module does not make use of the /GS security cookie.
@ CF_FUNCTION_TABLE_SIZE_16BYTES
@ CF_FUNCTION_TABLE_SIZE_11BYTES
@ CF_FUNCTION_TABLE_SIZE_12BYTES
@ CFW_INSTRUMENTED
Module performs control flow and write integrity checks.
@ CF_FUNCTION_TABLE_SIZE_9BYTES
@ CF_FUNCTION_TABLE_SIZE_10BYTES
@ CF_FUNCTION_TABLE_SIZE_14BYTES
@ CF_ENABLE_EXPORT_SUPPRESSION
Module enables suppression of exports.
@ IMAGE_REL_AMD64_REL32_5
@ IMAGE_REL_AMD64_REL32_3
@ IMAGE_REL_AMD64_ADDR32NB
@ IMAGE_REL_AMD64_ABSOLUTE
@ IMAGE_REL_AMD64_SECTION
@ IMAGE_REL_AMD64_REL32_2
@ IMAGE_REL_AMD64_REL32_1
@ IMAGE_REL_AMD64_SECREL7
@ IMAGE_REL_AMD64_REL32_4
@ IMAGE_REL_AMD64_SSPAN32
@ DELAY_IMPORT_DESCRIPTOR
SymbolStorageClass
Storage class tells where and what the symbol represents.
@ IMAGE_SYM_CLASS_MEMBER_OF_UNION
Member of union.
@ IMAGE_SYM_CLASS_AUTOMATIC
Stack variable.
@ IMAGE_SYM_CLASS_BIT_FIELD
Bit field.
@ IMAGE_SYM_CLASS_REGISTER
Register variable.
@ IMAGE_SYM_CLASS_SECTION
Line number, reformatted as symbol.
@ IMAGE_SYM_CLASS_REGISTER_PARAM
Register parameter.
@ IMAGE_SYM_CLASS_END_OF_STRUCT
End of structure.
@ IMAGE_SYM_CLASS_MEMBER_OF_ENUM
Member of enumeration.
@ IMAGE_SYM_CLASS_EXTERNAL_DEF
External definition.
@ IMAGE_SYM_CLASS_TYPE_DEFINITION
Type definition.
@ IMAGE_SYM_CLASS_MEMBER_OF_STRUCT
Member of structure.
@ IMAGE_SYM_CLASS_BLOCK
".bb" or ".eb" - beginning or end of block
@ IMAGE_SYM_CLASS_ENUM_TAG
Enumeration tag.
@ IMAGE_SYM_CLASS_UNION_TAG
Union tag.
@ IMAGE_SYM_CLASS_FUNCTION
".bf" or ".ef" - beginning or end of function
@ IMAGE_SYM_CLASS_STRUCT_TAG
Structure tag.
@ IMAGE_SYM_CLASS_EXTERNAL
External symbol.
@ IMAGE_SYM_CLASS_LABEL
Label.
@ IMAGE_SYM_CLASS_ARGUMENT
Function argument.
@ IMAGE_SYM_CLASS_END_OF_FUNCTION
Physical end of function.
@ IMAGE_SYM_CLASS_FILE
File name.
@ IMAGE_SYM_CLASS_UNDEFINED_STATIC
Undefined static.
@ IMAGE_SYM_CLASS_CLR_TOKEN
External symbol in dmert public lib.
@ IMAGE_SYM_CLASS_NULL
No symbol.
@ IMAGE_SYM_CLASS_UNDEFINED_LABEL
Undefined label.
@ 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_DVRT_ARM64X_FIXUP_TYPE_VALUE
@ IMAGE_DVRT_ARM64X_FIXUP_TYPE_DELTA
@ IMAGE_DVRT_ARM64X_FIXUP_TYPE_ZEROFILL
ExtendedDLLCharacteristics
@ IMAGE_DLL_CHARACTERISTICS_EX_CET_COMPAT
Image is CET compatible.
@ IMAGE_SUBSYSTEM_EFI_APPLICATION
An EFI application.
@ IMAGE_SUBSYSTEM_WINDOWS_CUI
The Windows character subsystem.
@ IMAGE_SUBSYSTEM_WINDOWS_CE_GUI
Windows CE.
@ IMAGE_SUBSYSTEM_XBOX
XBOX.
@ IMAGE_SUBSYSTEM_UNKNOWN
An unknown subsystem.
@ IMAGE_SUBSYSTEM_OS2_CUI
The OS/2 character subsystem.
@ IMAGE_SUBSYSTEM_NATIVE_WINDOWS
Native Windows 9x driver.
@ IMAGE_SUBSYSTEM_EFI_ROM
An EFI ROM image.
@ IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
An EFI driver with run-time services.
@ IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
An EFI driver with boot services.
@ IMAGE_SUBSYSTEM_POSIX_CUI
The POSIX character subsystem.
@ IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION
A BCD application.
@ IMAGE_SUBSYSTEM_WINDOWS_GUI
The Windows GUI subsystem.
@ IMAGE_SUBSYSTEM_NATIVE
Device drivers and native Windows processes.
static const char WinResMagic[]
@ IMAGE_COMDAT_SELECT_NODUPLICATES
@ IMAGE_COMDAT_SELECT_LARGEST
@ IMAGE_COMDAT_SELECT_NEWEST
@ IMAGE_COMDAT_SELECT_SAME_SIZE
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
@ IMAGE_COMDAT_SELECT_EXACT_MATCH
@ IMAGE_COMDAT_SELECT_ANY
WeakExternalCharacteristics
@ IMAGE_WEAK_EXTERN_SEARCH_ALIAS
@ IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY
@ IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY
@ IMAGE_WEAK_EXTERN_SEARCH_LIBRARY
@ DEBUG_HASHES_SECTION_MAGIC
@ IMAGE_REL_ARM_BRANCH20T
@ IMAGE_REL_ARM_BRANCH24T
bool isArm64EC(T Machine)
const int32_t MaxNumberOfSections16
@ IMPORT_ORDINAL
Import is by ordinal.
@ IMPORT_NAME_EXPORTAS
The import name is specified as a separate string in the import library object file.
@ IMPORT_NAME
The import name is identical to the public symbol name.
@ IMPORT_NAME_UNDECORATE
The import name is the public symbol name, but skipping the leading ?, @, or optionally _,...
@ IMPORT_NAME_NOPREFIX
The import name is the public symbol name, but skipping the leading ?, @, or optionally _.
bool isReservedSectionNumber(int32_t SectionNumber)
@ IMAGE_REL_I386_ABSOLUTE
@ IMAGE_SYM_TYPE_DOUBLE
An 8-byte floating-point number.
@ IMAGE_SYM_TYPE_DWORD
An unsigned 4-byte integer.
@ IMAGE_SYM_TYPE_STRUCT
A structure.
@ IMAGE_SYM_TYPE_SHORT
A 2-byte signed integer.
@ IMAGE_SYM_TYPE_UINT
An unsigned integer of natural size.
@ IMAGE_SYM_TYPE_NULL
No type information or unknown base type.
@ IMAGE_SYM_TYPE_CHAR
A character (signed byte).
@ IMAGE_SYM_TYPE_ENUM
An enumerated type.
@ IMAGE_SYM_TYPE_FLOAT
A 4-byte floating-point number.
@ IMAGE_SYM_TYPE_INT
A natural integer type on the target.
@ IMAGE_SYM_TYPE_LONG
A 4-byte signed integer.
@ IMAGE_SYM_TYPE_UNION
An union.
@ IMAGE_SYM_TYPE_MOE
A member of enumeration (a specific value).
@ IMAGE_SYM_TYPE_BYTE
A byte; unsigned 1-byte integer.
@ IMAGE_SYM_TYPE_WORD
A word; unsigned 2-byte integer.
@ IMAGE_SYM_TYPE_VOID
Used with void pointers and functions.
static const char BigObjMagic[]
@ IMAGE_FILE_LINE_NUMS_STRIPPED
COFF line numbers have been stripped.
@ IMAGE_FILE_DEBUG_STRIPPED
Debugging info has been removed.
@ IMAGE_FILE_DLL
The image file is a DLL.
@ IMAGE_FILE_AGGRESSIVE_WS_TRIM
Aggressively trim working set. This is deprecated and must be 0.
@ IMAGE_FILE_BYTES_REVERSED_LO
Little endian: the LSB precedes the MSB in memory.
@ IMAGE_FILE_UP_SYSTEM_ONLY
This file should only be run on a uniprocessor machine.
@ IMAGE_FILE_LARGE_ADDRESS_AWARE
Image can handle > 2GiB addresses.
@ IMAGE_FILE_BYTES_REVERSED_HI
Big endian: the MSB precedes the LSB in memory.
@ IMAGE_FILE_SYSTEM
The image file is a system file, not a user program.
@ IMAGE_FILE_32BIT_MACHINE
Machine is based on a 32bit word architecture.
@ IMAGE_FILE_LOCAL_SYMS_STRIPPED
COFF symbol table entries for local symbols have been removed.
@ IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
If the image is on removable media, fully load it and copy it to swap.
@ IMAGE_FILE_EXECUTABLE_IMAGE
The file is valid and can be run.
@ IMAGE_FILE_NET_RUN_FROM_SWAP
If the image is on network media, fully load it and copy it to swap.
@ IMAGE_FILE_RELOCS_STRIPPED
The file does not contain base relocations and must be loaded at its preferred base.
static const char PEMagic[]
@ IMAGE_SYM_DTYPE_ARRAY
An array of base type.
@ IMAGE_SYM_DTYPE_NULL
No complex type; simple scalar variable.
@ IMAGE_SYM_DTYPE_POINTER
A pointer to base type.
@ 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))
This is an optimization pass for GlobalISel generic memory operations.
uint32_t SymbolTableIndex
uint32_t PointerToNextFunction
uint32_t PointerToLinenumber
uint16_t NumberOfRelocations
uint16_t NumberOfLinenumbers
uint32_t PointerToNextFunction
uint32_t RelativeVirtualAddress
The Import Directory Table.
uint32_t ImportLookupTableRVA
uint32_t ImportAddressTableRVA
The PE32 Import Lookup Table.
uint32_t getHintNameRVA() const
Get the Hint/Name entry RVA. isOrdinal must be false.
void setHintNameRVA(uint32_t rva)
Set the Hint/Name entry RVA and set isOrdinal to false.
void setOrdinal(uint16_t o)
Set the ordinal value and set isOrdinal to true.
uint16_t getOrdinal() const
Get the ordinal value of this entry. isOrdinal must be true.
bool isOrdinal() const
Is this entry specified by ordinal, or name?
uint32_t SymbolTableIndex
uint32_t PointerToRelocations
uint16_t NumberOfLineNumbers
uint32_t PointerToRawData
uint16_t NumberOfRelocations
uint32_t PointerToLineNumbers
uint8_t NumberOfAuxSymbols
AuxiliarybfAndefSymbol bfAndefSymbol
AuxiliaryFunctionDefinition FunctionDefinition
AuxiliarySectionDefinition SectionDefinition
AuxiliaryWeakExternal WeakExternal