projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions
[oota-llvm.git]
/
include
/
llvm
/
Support
/
COFF.h
diff --git
a/include/llvm/Support/COFF.h
b/include/llvm/Support/COFF.h
index cdab90ffdec8f7d4341f4054fc8f3ce2d5b36a34..0162175efe3e66d6c6ef5937364f869d46130bd5 100644
(file)
--- a/
include/llvm/Support/COFF.h
+++ b/
include/llvm/Support/COFF.h
@@
-31,23
+31,30
@@
namespace llvm {
namespace COFF {
// The maximum number of sections that a COFF object can have (inclusive).
namespace COFF {
// The maximum number of sections that a COFF object can have (inclusive).
- const int
MaxNumberOfSections = 6529
9;
+ const int
32_t MaxNumberOfSections16 = 6527
9;
// The PE signature bytes that follows the DOS stub header.
static const char PEMagic[] = { 'P', 'E', '\0', '\0' };
// The PE signature bytes that follows the DOS stub header.
static const char PEMagic[] = { 'P', 'E', '\0', '\0' };
+ static const char BigObjMagic[] = {
+ '\xc7', '\xa1', '\xba', '\xd1', '\xee', '\xba', '\xa9', '\x4b',
+ '\xaf', '\x20', '\xfa', '\xf6', '\x6a', '\xa4', '\xdc', '\xb8',
+ };
+
// Sizes in bytes of various things in the COFF format.
enum {
// Sizes in bytes of various things in the COFF format.
enum {
- HeaderSize = 20,
+ Header16Size = 20,
+ Header32Size = 56,
NameSize = 8,
NameSize = 8,
- SymbolSize = 18,
+ Symbol16Size = 18,
+ Symbol32Size = 20,
SectionSize = 40,
RelocationSize = 10
};
struct header {
uint16_t Machine;
SectionSize = 40,
RelocationSize = 10
};
struct header {
uint16_t Machine;
-
uint16_t
NumberOfSections;
+
int32_t
NumberOfSections;
uint32_t TimeDateStamp;
uint32_t PointerToSymbolTable;
uint32_t NumberOfSymbols;
uint32_t TimeDateStamp;
uint32_t PointerToSymbolTable;
uint32_t NumberOfSymbols;
@@
-55,6
+62,24
@@
namespace COFF {
uint16_t Characteristics;
};
uint16_t Characteristics;
};
+ struct BigObjHeader {
+ enum : uint16_t { MinBigObjectVersion = 2 };
+
+ uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
+ uint16_t Sig2; ///< Must be 0xFFFF.
+ uint16_t Version;
+ uint16_t Machine;
+ uint32_t TimeDateStamp;
+ uint8_t UUID[16];
+ uint32_t unused1;
+ uint32_t unused2;
+ uint32_t unused3;
+ uint32_t unused4;
+ uint32_t NumberOfSections;
+ uint32_t PointerToSymbolTable;
+ uint32_t NumberOfSymbols;
+ };
+
enum MachineTypes {
MT_Invalid = 0xffff,
enum MachineTypes {
MT_Invalid = 0xffff,
@@
-63,6
+88,7
@@
namespace COFF {
IMAGE_FILE_MACHINE_AMD64 = 0x8664,
IMAGE_FILE_MACHINE_ARM = 0x1C0,
IMAGE_FILE_MACHINE_ARMNT = 0x1C4,
IMAGE_FILE_MACHINE_AMD64 = 0x8664,
IMAGE_FILE_MACHINE_ARM = 0x1C0,
IMAGE_FILE_MACHINE_ARMNT = 0x1C4,
+ IMAGE_FILE_MACHINE_ARM64 = 0xAA64,
IMAGE_FILE_MACHINE_EBC = 0xEBC,
IMAGE_FILE_MACHINE_I386 = 0x14C,
IMAGE_FILE_MACHINE_IA64 = 0x200,
IMAGE_FILE_MACHINE_EBC = 0xEBC,
IMAGE_FILE_MACHINE_I386 = 0x14C,
IMAGE_FILE_MACHINE_IA64 = 0x200,
@@
-124,25
+150,15
@@
namespace COFF {
struct symbol {
char Name[NameSize];
uint32_t Value;
struct symbol {
char Name[NameSize];
uint32_t Value;
-
uint16_t
SectionNumber;
+
int32_t
SectionNumber;
uint16_t Type;
uint8_t StorageClass;
uint8_t NumberOfAuxSymbols;
};
uint16_t Type;
uint8_t StorageClass;
uint8_t NumberOfAuxSymbols;
};
- enum SymbolFlags {
- SF_TypeMask = 0x0000FFFF,
- SF_TypeShift = 0,
-
- SF_ClassMask = 0x00FF0000,
- SF_ClassShift = 16,
-
- SF_WeakExternal = 0x01000000
- };
-
- enum SymbolSectionNumber {
- IMAGE_SYM_DEBUG = 0xFFFE,
- IMAGE_SYM_ABSOLUTE = 0xFFFF,
+ enum SymbolSectionNumber : int32_t {
+ IMAGE_SYM_DEBUG = -2,
+ IMAGE_SYM_ABSOLUTE = -1,
IMAGE_SYM_UNDEFINED = 0
};
IMAGE_SYM_UNDEFINED = 0
};
@@
-232,6
+248,7
@@
namespace COFF {
enum SectionCharacteristics : uint32_t {
SC_Invalid = 0xffffffff,
enum SectionCharacteristics : uint32_t {
SC_Invalid = 0xffffffff,
+ IMAGE_SCN_TYPE_NOLOAD = 0x00000002,
IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
IMAGE_SCN_CNT_CODE = 0x00000020,
IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
IMAGE_SCN_CNT_CODE = 0x00000020,
IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
@@
-367,18
+384,14
@@
namespace COFF {
IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
};
IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
};
- struct AuxiliaryFile {
- uint8_t FileName[18];
- };
-
struct AuxiliarySectionDefinition {
uint32_t Length;
uint16_t NumberOfRelocations;
uint16_t NumberOfLinenumbers;
uint32_t CheckSum;
struct AuxiliarySectionDefinition {
uint32_t Length;
uint16_t NumberOfRelocations;
uint16_t NumberOfLinenumbers;
uint32_t CheckSum;
- uint
16
_t Number;
+ uint
32
_t Number;
uint8_t Selection;
uint8_t Selection;
- char unused
[3]
;
+ char unused;
};
struct AuxiliaryCLRToken {
};
struct AuxiliaryCLRToken {
@@
-392,7
+405,6
@@
namespace COFF {
AuxiliaryFunctionDefinition FunctionDefinition;
AuxiliarybfAndefSymbol bfAndefSymbol;
AuxiliaryWeakExternal WeakExternal;
AuxiliaryFunctionDefinition FunctionDefinition;
AuxiliarybfAndefSymbol bfAndefSymbol;
AuxiliaryWeakExternal WeakExternal;
- AuxiliaryFile File;
AuxiliarySectionDefinition SectionDefinition;
};
AuxiliarySectionDefinition SectionDefinition;
};
@@
-495,12
+507,14
@@
namespace COFF {
uint32_t SizeOfHeaders;
uint32_t CheckSum;
uint16_t Subsystem;
uint32_t SizeOfHeaders;
uint32_t CheckSum;
uint16_t Subsystem;
+ // FIXME: This should be DllCharacteristics to match the COFF spec.
uint16_t DLLCharacteristics;
uint32_t SizeOfStackReserve;
uint32_t SizeOfStackCommit;
uint32_t SizeOfHeapReserve;
uint32_t SizeOfHeapCommit;
uint32_t LoaderFlags;
uint16_t DLLCharacteristics;
uint32_t SizeOfStackReserve;
uint32_t SizeOfStackCommit;
uint32_t SizeOfHeapReserve;
uint32_t SizeOfHeapCommit;
uint32_t LoaderFlags;
+ // FIXME: This should be NumberOfRvaAndSizes to match the COFF spec.
uint32_t NumberOfRvaAndSize;
};
uint32_t NumberOfRvaAndSize;
};
@@
-524,7
+538,9
@@
namespace COFF {
BOUND_IMPORT,
IAT,
DELAY_IMPORT_DESCRIPTOR,
BOUND_IMPORT,
IAT,
DELAY_IMPORT_DESCRIPTOR,
- CLR_RUNTIME_HEADER
+ CLR_RUNTIME_HEADER,
+
+ NUM_DATA_DIRECTORIES
};
enum WindowsSubsystem {
};
enum WindowsSubsystem {
@@
-562,8
+578,12
@@
namespace COFF {
IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
/// Do not bind the image.
IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
/// Do not bind the image.
IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
+ ///< Image should execute in an AppContainer.
+ IMAGE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000,
///< A WDM driver.
IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000,
///< A WDM driver.
IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000,
+ ///< Image supports Control Flow Guard.
+ IMAGE_DLL_CHARACTERISTICS_GUARD_CF = 0x4000,
/// Terminal Server aware.
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
};
/// Terminal Server aware.
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
};
@@
-636,15
+656,21
@@
namespace COFF {
}
};
}
};
- enum CodeViewLineTableIdentifiers {
- DEBUG_SECTION_MAGIC = 0x4,
- DEBUG_LINE_TABLE_SUBSECTION = 0xF2,
+ enum CodeViewIdentifiers {
+ DEBUG_LINE_TABLES_HAVE_COLUMN_RECORDS = 0x1,
+ DEBUG_SECTION_MAGIC = 0x4,
+ DEBUG_SYMBOL_SUBSECTION = 0xF1,
+ DEBUG_LINE_TABLE_SUBSECTION = 0xF2,
DEBUG_STRING_TABLE_SUBSECTION = 0xF3,
DEBUG_STRING_TABLE_SUBSECTION = 0xF3,
- DEBUG_INDEX_SUBSECTION = 0xF4
+ DEBUG_INDEX_SUBSECTION = 0xF4,
+
+ // Symbol subsections are split into records of different types.
+ DEBUG_SYMBOL_TYPE_PROC_START = 0x1147,
+ DEBUG_SYMBOL_TYPE_PROC_END = 0x114F
};
};
- inline bool isReservedSectionNumber(int
N
) {
- return
N == IMAGE_SYM_UNDEFINED || N > MaxNumberOfSections
;
+ inline bool isReservedSectionNumber(int
32_t SectionNumber
) {
+ return
SectionNumber <= 0
;
}
} // End namespace COFF.
}
} // End namespace COFF.