diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/COFF.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/Object/WindowsResource.h | 49 |
2 files changed, 11 insertions, 44 deletions
diff --git a/llvm/include/llvm/BinaryFormat/COFF.h b/llvm/include/llvm/BinaryFormat/COFF.h index b395db6eaa8..138e44bfec2 100644 --- a/llvm/include/llvm/BinaryFormat/COFF.h +++ b/llvm/include/llvm/BinaryFormat/COFF.h @@ -46,12 +46,6 @@ static const char ClGlObjMagic[] = { '\xac', '\x9b', '\xd6', '\xb6', '\x22', '\x26', '\x53', '\xc2', }; -// The signature bytes that start a .res file. -static const char WinResMagic[] = { - '\x00', '\x00', '\x00', '\x00', '\x20', '\x00', '\x00', '\x00', - '\xff', '\xff', '\x00', '\x00', '\xff', '\xff', '\x00', '\x00', -}; - // Sizes in bytes of various things in the COFF format. enum { Header16Size = 20, diff --git a/llvm/include/llvm/Object/WindowsResource.h b/llvm/include/llvm/Object/WindowsResource.h index 3d32409fd4a..1ef00e2909f 100644 --- a/llvm/include/llvm/Object/WindowsResource.h +++ b/llvm/include/llvm/Object/WindowsResource.h @@ -43,47 +43,12 @@ #include <map> namespace llvm { + namespace object { class WindowsResource; -const size_t WIN_RES_MAGIC_SIZE = 16; -const size_t WIN_RES_NULL_ENTRY_SIZE = 16; -const uint32_t WIN_RES_HEADER_ALIGNMENT = 4; -const uint32_t WIN_RES_DATA_ALIGNMENT = 4; -const uint16_t WIN_RES_PURE_MOVEABLE = 0x0030; - -struct WinResHeaderPrefix { - support::ulittle32_t DataSize; - support::ulittle32_t HeaderSize; -}; - -// Type and Name may each either be an integer ID or a string. This struct is -// only used in the case where they are both IDs. -struct WinResIDs { - uint16_t TypeFlag; - support::ulittle16_t TypeID; - uint16_t NameFlag; - support::ulittle16_t NameID; - - void setType(uint16_t ID) { - TypeFlag = 0xffff; - TypeID = ID; - } - - void setName(uint16_t ID) { - NameFlag = 0xffff; - NameID = ID; - } -}; - -struct WinResHeaderSuffix { - support::ulittle32_t DataVersion; - support::ulittle16_t MemoryFlags; - support::ulittle16_t Language; - support::ulittle32_t Version; - support::ulittle32_t Characteristics; -}; +enum class Machine { UNKNOWN, ARM, X64, X86 }; class ResourceEntryRef { public: @@ -108,6 +73,14 @@ private: Error loadNext(); + struct HeaderSuffix { + support::ulittle32_t DataVersion; + support::ulittle16_t MemoryFlags; + support::ulittle16_t Language; + support::ulittle32_t Version; + support::ulittle32_t Characteristics; + }; + BinaryStreamReader Reader; bool IsStringType; ArrayRef<UTF16> Type; @@ -115,7 +88,7 @@ private: bool IsStringName; ArrayRef<UTF16> Name; uint16_t NameID; - const WinResHeaderSuffix *Suffix = nullptr; + const HeaderSuffix *Suffix = nullptr; ArrayRef<uint8_t> Data; const WindowsResource *OwningRes = nullptr; }; |