Move sys::fs::AccessMode out of @brief in the function. [-Wdocumentation]
[oota-llvm.git] / include / llvm / Support / COFF.h
index dca7fc6ee8984cc4c440ea1b377c3e2615bdf867..f555fbeb4410c40d7906b829660a537ef6478745 100644 (file)
@@ -31,11 +31,16 @@ namespace llvm {
 namespace COFF {
 
   // The maximum number of sections that a COFF object can have (inclusive).
-  const int MaxNumberOfSections = 65299;
+  const uint16_t MaxNumberOfSections16 = 65299;
 
   // 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 {
     HeaderSize     = 20,
@@ -55,6 +60,24 @@ namespace COFF {
     uint16_t Characteristics;
   };
 
+  struct BigObjHeader {
+    enum { 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,
 
@@ -140,9 +163,9 @@ namespace COFF {
     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
   };
 
@@ -275,7 +298,7 @@ namespace COFF {
     uint16_t Type;
   };
 
-  enum RelocationTypeX86 {
+  enum RelocationTypeI386 {
     IMAGE_REL_I386_ABSOLUTE = 0x0000,
     IMAGE_REL_I386_DIR16    = 0x0001,
     IMAGE_REL_I386_REL16    = 0x0002,
@@ -286,8 +309,10 @@ namespace COFF {
     IMAGE_REL_I386_SECREL   = 0x000B,
     IMAGE_REL_I386_TOKEN    = 0x000C,
     IMAGE_REL_I386_SECREL7  = 0x000D,
-    IMAGE_REL_I386_REL32    = 0x0014,
+    IMAGE_REL_I386_REL32    = 0x0014
+  };
 
+  enum RelocationTypeAMD64 {
     IMAGE_REL_AMD64_ABSOLUTE  = 0x0000,
     IMAGE_REL_AMD64_ADDR64    = 0x0001,
     IMAGE_REL_AMD64_ADDR32    = 0x0002,
@@ -551,7 +576,8 @@ namespace COFF {
     IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040,
     /// Code integrity checks are enforced.
     IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
-    IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100, ///< Image is NX compatible.
+    ///< Image is NX compatible.
+    IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100,
     /// Isolation aware, but do not isolate the image.
     IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION = 0x0200,
     /// Does not use structured exception handling (SEH). No SEH handler may be
@@ -559,7 +585,12 @@ namespace COFF {
     IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
     /// Do not bind the image.
     IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
-    IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000, ///< A WDM driver.
+    ///< Image should execute in an AppContainer.
+    IMAGE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000,
+    ///< 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
   };
@@ -639,8 +670,8 @@ namespace COFF {
     DEBUG_INDEX_SUBSECTION        = 0xF4
   };
 
-  inline bool isReservedSectionNumber(int N) {
-    return N == IMAGE_SYM_UNDEFINED || N > MaxNumberOfSections;
+  inline bool isReservedSectionNumber(int32_t SectionNumber) {
+    return SectionNumber <= 0;
   }
 
 } // End namespace COFF.