diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 07:19:41 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 07:19:41 +0000 |
commit | a956d8b71755b908d8a150736e8857d2214060c6 (patch) | |
tree | 6ac44d294bb7e144b41f7316b518250c8b07a61d /include/llvm/Object/MachOFormat.h | |
parent | bce55776af16b70408e2ae2e6d91f8ac1e43f6a7 (diff) |
Object/Mach-O: Add header and load command information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object/MachOFormat.h')
-rw-r--r-- | include/llvm/Object/MachOFormat.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/include/llvm/Object/MachOFormat.h b/include/llvm/Object/MachOFormat.h index 61a19643f0..87e4f4241c 100644 --- a/include/llvm/Object/MachOFormat.h +++ b/include/llvm/Object/MachOFormat.h @@ -22,6 +22,8 @@ #ifndef LLVM_OBJECT_MACHOFORMAT_H #define LLVM_OBJECT_MACHOFORMAT_H +#include "llvm/System/DataTypes.h" + namespace llvm { namespace object { @@ -83,13 +85,6 @@ namespace mach { /// Format information for Mach object files. namespace macho { - /// \brief Constants for header magic field. - enum HeaderMagic { - HM_Object32 = 0xFEEDFACE, ///< 32-bit mach object file - HM_Object64 = 0xFEEDFACF, ///< 64-bit mach object file - HM_Universal = 0xCAFEBABE ///< Universal object file - }; - /// \brief Constants for structure sizes. enum StructureSizes { Header32Size = 28, @@ -105,6 +100,29 @@ namespace macho { RelocationInfoSize = 8 }; + /// \brief Constants for header magic field. + enum HeaderMagic { + HM_Object32 = 0xFEEDFACE, ///< 32-bit mach object file + HM_Object64 = 0xFEEDFACF, ///< 64-bit mach object file + HM_Universal = 0xCAFEBABE ///< Universal object file + }; + + /// \brief Header common to all Mach object files. + struct Header { + uint32_t Magic; + uint32_t CPUType; + uint32_t CPUSubtype; + uint32_t FileType; + uint32_t NumLoadCommands; + uint32_t SizeOfLoadCommands; + uint32_t Flags; + }; + + /// \brief Extended header for 64-bit object files. + struct Header64Ext { + uint32_t Reserved; + }; + // See <mach-o/loader.h>. enum HeaderFileType { HFT_Object = 0x1 @@ -118,7 +136,14 @@ namespace macho { LCT_Segment = 0x1, LCT_Symtab = 0x2, LCT_Dysymtab = 0xb, - LCT_Segment64 = 0x19 + LCT_Segment64 = 0x19, + LCT_UUID = 0x1b + }; + + /// \brief Load command structure. + struct LoadCommand { + uint32_t Type; + uint32_t Size; }; // See <mach-o/nlist.h>. |