1 //===- MachOFormat.h - Mach-O Format Structures And Constants ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares various structures and constants which are platform
11 // independent and can be shared by any client which wishes to interact with
14 // The definitions here are purposely chosen to match the LLVM style as opposed
15 // to following the platform specific definition of the format.
17 // On a Mach system, see the <mach-o/...> includes for more information, in
18 // particular <mach-o/loader.h>.
20 //===----------------------------------------------------------------------===//
22 #ifndef LLVM_OBJECT_MACHOFORMAT_H
23 #define LLVM_OBJECT_MACHOFORMAT_H
28 /// General Mach platform information.
30 /// @name CPU Type and Subtype Information
33 /// \brief Capability bits used in CPU type encoding.
34 enum CPUTypeFlagsMask {
35 CTFM_ArchMask = 0xFF000000,
36 CTFM_ArchABI64 = 0x01000000
39 /// \brief Machine type IDs used in CPU type encoding.
42 CTM_x86_64 = CTM_i386 | CTFM_ArchABI64,
46 CTM_PowerPC64 = CTM_PowerPC | CTFM_ArchABI64
49 /// \brief Capability bits used in CPU subtype encoding.
50 enum CPUSubtypeFlagsMask {
51 CSFM_SubtypeMask = 0xFF000000,
52 CSFM_SubtypeLib64 = 0x80000000
55 /// \brief ARM Machine Subtypes.
65 /// \brief PowerPC Machine Subtypes.
66 enum CPUSubtypePowerPC {
70 /// \brief SPARC Machine Subtypes.
71 enum CPUSubtypeSPARC {
75 /// \brief x86 Machine Subtypes.
82 } // end namespace mach
84 /// Format information for Mach object files.
86 /// \brief Constants for header magic field.
88 HM_Object32 = 0xFEEDFACE, ///< 32-bit mach object file
89 HM_Object64 = 0xFEEDFACF, ///< 64-bit mach object file
90 HM_Universal = 0xCAFEBABE ///< Universal object file
93 /// \brief Constants for structure sizes.
97 SegmentLoadCommand32Size = 56,
98 SegmentLoadCommand64Size = 72,
101 SymtabLoadCommandSize = 24,
102 DysymtabLoadCommandSize = 80,
105 RelocationInfoSize = 8
107 } // end namespace macho
109 } // end namespace object
110 } // end namespace llvm