1 //===-- llvm/Support/MachO.h - The MachO file format ------------*- 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 defines manifest constants for the MachO object file format.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_SUPPORT_MACHO_H
15 #define LLVM_SUPPORT_MACHO_H
17 #include "llvm/Support/Compiler.h"
18 #include "llvm/Support/DataTypes.h"
19 #include "llvm/Support/Host.h"
23 // Enums from <mach-o/loader.h>
25 // Constants for the "magic" field in llvm::MachO::mach_header and
26 // llvm::MachO::mach_header_64
27 MH_MAGIC = 0xFEEDFACEu,
28 MH_CIGAM = 0xCEFAEDFEu,
29 MH_MAGIC_64 = 0xFEEDFACFu,
30 MH_CIGAM_64 = 0xCFFAEDFEu,
31 FAT_MAGIC = 0xCAFEBABEu,
32 FAT_CIGAM = 0xBEBAFECAu
36 // Constants for the "filetype" field in llvm::MachO::mach_header and
37 // llvm::MachO::mach_header_64
52 // Constant bits for the "flags" field in llvm::MachO::mach_header and
53 // llvm::MachO::mach_header_64
54 MH_NOUNDEFS = 0x00000001u,
55 MH_INCRLINK = 0x00000002u,
56 MH_DYLDLINK = 0x00000004u,
57 MH_BINDATLOAD = 0x00000008u,
58 MH_PREBOUND = 0x00000010u,
59 MH_SPLIT_SEGS = 0x00000020u,
60 MH_LAZY_INIT = 0x00000040u,
61 MH_TWOLEVEL = 0x00000080u,
62 MH_FORCE_FLAT = 0x00000100u,
63 MH_NOMULTIDEFS = 0x00000200u,
64 MH_NOFIXPREBINDING = 0x00000400u,
65 MH_PREBINDABLE = 0x00000800u,
66 MH_ALLMODSBOUND = 0x00001000u,
67 MH_SUBSECTIONS_VIA_SYMBOLS = 0x00002000u,
68 MH_CANONICAL = 0x00004000u,
69 MH_WEAK_DEFINES = 0x00008000u,
70 MH_BINDS_TO_WEAK = 0x00010000u,
71 MH_ALLOW_STACK_EXECUTION = 0x00020000u,
72 MH_ROOT_SAFE = 0x00040000u,
73 MH_SETUID_SAFE = 0x00080000u,
74 MH_NO_REEXPORTED_DYLIBS = 0x00100000u,
76 MH_DEAD_STRIPPABLE_DYLIB = 0x00400000u
80 // Flags for the "cmd" field in llvm::MachO::load_command
81 LC_REQ_DYLD = 0x80000000u
84 enum LoadCommandType : uint32_t {
85 // Constants for the "cmd" field in llvm::MachO::load_command
86 LC_SEGMENT = 0x00000001u,
87 LC_SYMTAB = 0x00000002u,
88 LC_SYMSEG = 0x00000003u,
89 LC_THREAD = 0x00000004u,
90 LC_UNIXTHREAD = 0x00000005u,
91 LC_LOADFVMLIB = 0x00000006u,
92 LC_IDFVMLIB = 0x00000007u,
93 LC_IDENT = 0x00000008u,
94 LC_FVMFILE = 0x00000009u,
95 LC_PREPAGE = 0x0000000Au,
96 LC_DYSYMTAB = 0x0000000Bu,
97 LC_LOAD_DYLIB = 0x0000000Cu,
98 LC_ID_DYLIB = 0x0000000Du,
99 LC_LOAD_DYLINKER = 0x0000000Eu,
100 LC_ID_DYLINKER = 0x0000000Fu,
101 LC_PREBOUND_DYLIB = 0x00000010u,
102 LC_ROUTINES = 0x00000011u,
103 LC_SUB_FRAMEWORK = 0x00000012u,
104 LC_SUB_UMBRELLA = 0x00000013u,
105 LC_SUB_CLIENT = 0x00000014u,
106 LC_SUB_LIBRARY = 0x00000015u,
107 LC_TWOLEVEL_HINTS = 0x00000016u,
108 LC_PREBIND_CKSUM = 0x00000017u,
109 LC_LOAD_WEAK_DYLIB = 0x80000018u,
110 LC_SEGMENT_64 = 0x00000019u,
111 LC_ROUTINES_64 = 0x0000001Au,
112 LC_UUID = 0x0000001Bu,
113 LC_RPATH = 0x8000001Cu,
114 LC_CODE_SIGNATURE = 0x0000001Du,
115 LC_SEGMENT_SPLIT_INFO = 0x0000001Eu,
116 LC_REEXPORT_DYLIB = 0x8000001Fu,
117 LC_LAZY_LOAD_DYLIB = 0x00000020u,
118 LC_ENCRYPTION_INFO = 0x00000021u,
119 LC_DYLD_INFO = 0x00000022u,
120 LC_DYLD_INFO_ONLY = 0x80000022u,
121 LC_LOAD_UPWARD_DYLIB = 0x80000023u,
122 LC_VERSION_MIN_MACOSX = 0x00000024u,
123 LC_VERSION_MIN_IPHONEOS = 0x00000025u,
124 LC_FUNCTION_STARTS = 0x00000026u,
125 LC_DYLD_ENVIRONMENT = 0x00000027u,
126 LC_MAIN = 0x80000028u,
127 LC_DATA_IN_CODE = 0x00000029u,
128 LC_SOURCE_VERSION = 0x0000002Au,
129 LC_DYLIB_CODE_SIGN_DRS = 0x0000002Bu,
131 LC_LINKER_OPTIONS = 0x0000002Du,
132 LC_LINKER_OPTIMIZATION_HINT = 0x0000002Eu
136 // Constant bits for the "flags" field in llvm::MachO::segment_command
140 SG_PROTECTED_VERSION_1 = 0x8u,
143 // Constant masks for the "flags" field in llvm::MachO::section and
144 // llvm::MachO::section_64
145 SECTION_TYPE = 0x000000ffu, // SECTION_TYPE
146 SECTION_ATTRIBUTES = 0xffffff00u, // SECTION_ATTRIBUTES
147 SECTION_ATTRIBUTES_USR = 0xff000000u, // SECTION_ATTRIBUTES_USR
148 SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
151 /// These are the section type and attributes fields. A MachO section can
152 /// have only one Type, but can have any of the attributes specified.
153 enum SectionType : uint32_t {
154 // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
155 // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
158 S_CSTRING_LITERALS = 0x02u,
159 S_4BYTE_LITERALS = 0x03u,
160 S_8BYTE_LITERALS = 0x04u,
161 S_LITERAL_POINTERS = 0x05u,
162 S_NON_LAZY_SYMBOL_POINTERS = 0x06u,
163 S_LAZY_SYMBOL_POINTERS = 0x07u,
164 S_SYMBOL_STUBS = 0x08u,
165 S_MOD_INIT_FUNC_POINTERS = 0x09u,
166 S_MOD_TERM_FUNC_POINTERS = 0x0au,
168 S_GB_ZEROFILL = 0x0cu,
169 S_INTERPOSING = 0x0du,
170 S_16BYTE_LITERALS = 0x0eu,
171 S_DTRACE_DOF = 0x0fu,
172 S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10u,
173 S_THREAD_LOCAL_REGULAR = 0x11u,
174 S_THREAD_LOCAL_ZEROFILL = 0x12u,
175 S_THREAD_LOCAL_VARIABLES = 0x13u,
176 S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
177 S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u,
179 LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
183 // Constant masks for the "flags[31:24]" field in llvm::MachO::section and
184 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
185 S_ATTR_PURE_INSTRUCTIONS = 0x80000000u,
186 S_ATTR_NO_TOC = 0x40000000u,
187 S_ATTR_STRIP_STATIC_SYMS = 0x20000000u,
188 S_ATTR_NO_DEAD_STRIP = 0x10000000u,
189 S_ATTR_LIVE_SUPPORT = 0x08000000u,
190 S_ATTR_SELF_MODIFYING_CODE = 0x04000000u,
191 S_ATTR_DEBUG = 0x02000000u,
193 // Constant masks for the "flags[23:8]" field in llvm::MachO::section and
194 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
195 S_ATTR_SOME_INSTRUCTIONS = 0x00000400u,
196 S_ATTR_EXT_RELOC = 0x00000200u,
197 S_ATTR_LOC_RELOC = 0x00000100u,
199 // Constant masks for the value of an indirect symbol in an indirect
201 INDIRECT_SYMBOL_LOCAL = 0x80000000u,
202 INDIRECT_SYMBOL_ABS = 0x40000000u
205 enum DataRegionType {
206 // Constants for the "kind" field in a data_in_code_entry structure
208 DICE_KIND_JUMP_TABLE8 = 2u,
209 DICE_KIND_JUMP_TABLE16 = 3u,
210 DICE_KIND_JUMP_TABLE32 = 4u,
211 DICE_KIND_ABS_JUMP_TABLE32 = 5u
215 REBASE_TYPE_POINTER = 1u,
216 REBASE_TYPE_TEXT_ABSOLUTE32 = 2u,
217 REBASE_TYPE_TEXT_PCREL32 = 3u
221 REBASE_OPCODE_MASK = 0xF0u,
222 REBASE_IMMEDIATE_MASK = 0x0Fu
226 REBASE_OPCODE_DONE = 0x00u,
227 REBASE_OPCODE_SET_TYPE_IMM = 0x10u,
228 REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x20u,
229 REBASE_OPCODE_ADD_ADDR_ULEB = 0x30u,
230 REBASE_OPCODE_ADD_ADDR_IMM_SCALED = 0x40u,
231 REBASE_OPCODE_DO_REBASE_IMM_TIMES = 0x50u,
232 REBASE_OPCODE_DO_REBASE_ULEB_TIMES = 0x60u,
233 REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB = 0x70u,
234 REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 0x80u
238 BIND_TYPE_POINTER = 1u,
239 BIND_TYPE_TEXT_ABSOLUTE32 = 2u,
240 BIND_TYPE_TEXT_PCREL32 = 3u
243 enum BindSpecialDylib {
244 BIND_SPECIAL_DYLIB_SELF = 0,
245 BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE = -1,
246 BIND_SPECIAL_DYLIB_FLAT_LOOKUP = -2
250 BIND_SYMBOL_FLAGS_WEAK_IMPORT = 0x1u,
251 BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION = 0x8u,
253 BIND_OPCODE_MASK = 0xF0u,
254 BIND_IMMEDIATE_MASK = 0x0Fu
258 BIND_OPCODE_DONE = 0x00u,
259 BIND_OPCODE_SET_DYLIB_ORDINAL_IMM = 0x10u,
260 BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 0x20u,
261 BIND_OPCODE_SET_DYLIB_SPECIAL_IMM = 0x30u,
262 BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM = 0x40u,
263 BIND_OPCODE_SET_TYPE_IMM = 0x50u,
264 BIND_OPCODE_SET_ADDEND_SLEB = 0x60u,
265 BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x70u,
266 BIND_OPCODE_ADD_ADDR_ULEB = 0x80u,
267 BIND_OPCODE_DO_BIND = 0x90u,
268 BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB = 0xA0u,
269 BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED = 0xB0u,
270 BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 0xC0u
274 EXPORT_SYMBOL_FLAGS_KIND_MASK = 0x03u,
275 EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION = 0x04u,
276 EXPORT_SYMBOL_FLAGS_REEXPORT = 0x08u,
277 EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER = 0x10u
280 enum ExportSymbolKind {
281 EXPORT_SYMBOL_FLAGS_KIND_REGULAR = 0x00u,
282 EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL = 0x01u
287 // Constant masks for the "n_type" field in llvm::MachO::nlist and
288 // llvm::MachO::nlist_64
296 // Constants for the "n_type & N_TYPE" llvm::MachO::nlist and
297 // llvm::MachO::nlist_64
305 enum SectionOrdinal {
306 // Constants for the "n_sect" field in llvm::MachO::nlist and
307 // llvm::MachO::nlist_64
313 // Constant masks for the "n_desc" field in llvm::MachO::nlist and
314 // llvm::MachO::nlist_64
315 N_ARM_THUMB_DEF = 0x0008u,
316 N_NO_DEAD_STRIP = 0x0020u,
317 N_WEAK_REF = 0x0040u,
318 N_WEAK_DEF = 0x0080u,
319 N_SYMBOL_RESOLVER = 0x0100u
323 // Constant values for the "n_type" field in llvm::MachO::nlist and
324 // llvm::MachO::nlist_64 when "(n_type & NlistMaskStab) != 0"
357 // Constant values for the r_symbolnum field in an
358 // llvm::MachO::relocation_info structure when r_extern is 0.
361 // Constant bits for the r_address field in an
362 // llvm::MachO::relocation_info structure.
363 R_SCATTERED = 0x80000000
366 enum RelocationInfoType {
367 // Constant values for the r_type field in an
368 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
370 GENERIC_RELOC_VANILLA = 0,
371 GENERIC_RELOC_PAIR = 1,
372 GENERIC_RELOC_SECTDIFF = 2,
373 GENERIC_RELOC_PB_LA_PTR = 3,
374 GENERIC_RELOC_LOCAL_SECTDIFF = 4,
375 GENERIC_RELOC_TLV = 5,
377 // Constant values for the r_type field in a PowerPC architecture
378 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
380 PPC_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
381 PPC_RELOC_PAIR = GENERIC_RELOC_PAIR,
388 PPC_RELOC_SECTDIFF = 8,
389 PPC_RELOC_PB_LA_PTR = 9,
390 PPC_RELOC_HI16_SECTDIFF = 10,
391 PPC_RELOC_LO16_SECTDIFF = 11,
392 PPC_RELOC_HA16_SECTDIFF = 12,
394 PPC_RELOC_LO14_SECTDIFF = 14,
395 PPC_RELOC_LOCAL_SECTDIFF = 15,
397 // Constant values for the r_type field in an ARM architecture
398 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
400 ARM_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
401 ARM_RELOC_PAIR = GENERIC_RELOC_PAIR,
402 ARM_RELOC_SECTDIFF = GENERIC_RELOC_SECTDIFF,
403 ARM_RELOC_LOCAL_SECTDIFF = 3,
404 ARM_RELOC_PB_LA_PTR = 4,
406 ARM_THUMB_RELOC_BR22 = 6,
407 ARM_THUMB_32BIT_BRANCH = 7, // obsolete
409 ARM_RELOC_HALF_SECTDIFF = 9,
411 // Constant values for the r_type field in an ARM64 architecture
412 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
416 ARM64_RELOC_UNSIGNED = 0,
417 // Must be followed by an ARM64_RELOC_UNSIGNED
418 ARM64_RELOC_SUBTRACTOR = 1,
419 // A B/BL instruction with 26-bit displacement.
420 ARM64_RELOC_BRANCH26 = 2,
421 // PC-rel distance to page of target.
422 ARM64_RELOC_PAGE21 = 3,
423 // Offset within page, scaled by r_length.
424 ARM64_RELOC_PAGEOFF12 = 4,
425 // PC-rel distance to page of GOT slot.
426 ARM64_RELOC_GOT_LOAD_PAGE21 = 5,
427 // Offset within page of GOT slot, scaled by r_length.
428 ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6,
429 // For pointers to GOT slots.
430 ARM64_RELOC_POINTER_TO_GOT = 7,
431 // PC-rel distance to page of TLVP slot.
432 ARM64_RELOC_TLVP_LOAD_PAGE21 = 8,
433 // Offset within page of TLVP slot, scaled by r_length.
434 ARM64_RELOC_TLVP_LOAD_PAGEOFF12 = 9,
435 // Must be followed by ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12.
436 ARM64_RELOC_ADDEND = 10,
439 // Constant values for the r_type field in an x86_64 architecture
440 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
442 X86_64_RELOC_UNSIGNED = 0,
443 X86_64_RELOC_SIGNED = 1,
444 X86_64_RELOC_BRANCH = 2,
445 X86_64_RELOC_GOT_LOAD = 3,
446 X86_64_RELOC_GOT = 4,
447 X86_64_RELOC_SUBTRACTOR = 5,
448 X86_64_RELOC_SIGNED_1 = 6,
449 X86_64_RELOC_SIGNED_2 = 7,
450 X86_64_RELOC_SIGNED_4 = 8,
454 // Values for segment_command.initprot.
455 // From <mach/vm_prot.h>
459 VM_PROT_EXECUTE = 0x4
463 // Structs from <mach-o/loader.h>
475 struct mach_header_64 {
486 struct load_command {
491 struct segment_command {
505 struct segment_command_64 {
550 uint32_t minor_version;
551 uint32_t header_addr;
554 struct fvmlib_command {
557 struct fvmlib fvmlib;
563 uint32_t current_version;
564 uint32_t compatibility_version;
567 struct dylib_command {
573 struct sub_framework_command {
579 struct sub_client_command {
585 struct sub_umbrella_command {
588 uint32_t sub_umbrella;
591 struct sub_library_command {
594 uint32_t sub_library;
597 struct prebound_dylib_command {
602 uint32_t linked_modules;
605 struct dylinker_command {
611 struct thread_command {
616 struct routines_command {
619 uint32_t init_address;
620 uint32_t init_module;
629 struct routines_command_64 {
632 uint64_t init_address;
633 uint64_t init_module;
642 struct symtab_command {
651 struct dysymtab_command {
664 uint32_t extrefsymoff;
665 uint32_t nextrefsyms;
666 uint32_t indirectsymoff;
667 uint32_t nindirectsyms;
674 struct dylib_table_of_contents {
675 uint32_t symbol_index;
676 uint32_t module_index;
679 struct dylib_module {
680 uint32_t module_name;
689 uint32_t iinit_iterm;
690 uint32_t ninit_nterm;
691 uint32_t objc_module_info_addr;
692 uint32_t objc_module_info_size;
695 struct dylib_module_64 {
696 uint32_t module_name;
705 uint32_t iinit_iterm;
706 uint32_t ninit_nterm;
707 uint32_t objc_module_info_size;
708 uint64_t objc_module_info_addr;
711 struct dylib_reference {
717 struct twolevel_hints_command {
724 struct twolevel_hint {
725 uint32_t isub_image:8,
729 struct prebind_cksum_command {
735 struct uuid_command {
741 struct rpath_command {
747 struct linkedit_data_command {
754 struct data_in_code_entry {
760 struct source_version_command {
766 struct encryption_info_command {
774 struct version_min_command {
775 uint32_t cmd; // LC_VERSION_MIN_MACOSX or
776 // LC_VERSION_MIN_IPHONEOS
777 uint32_t cmdsize; // sizeof(struct version_min_command)
778 uint32_t version; // X.Y.Z is encoded in nibbles xxxx.yy.zz
782 struct dyld_info_command {
786 uint32_t rebase_size;
789 uint32_t weak_bind_off;
790 uint32_t weak_bind_size;
791 uint32_t lazy_bind_off;
792 uint32_t lazy_bind_size;
794 uint32_t export_size;
797 struct linker_options_command {
803 struct symseg_command {
810 struct ident_command {
815 struct fvmfile_command {
819 uint32_t header_addr;
822 struct tlv_descriptor_32 {
828 struct tlv_descriptor_64 {
834 struct tlv_descriptor {
840 struct entry_point_command {
848 // Structs from <mach-o/fat.h>
862 // Structs from <mach-o/reloc.h>
863 struct relocation_info {
865 uint32_t r_symbolnum:24,
872 struct scattered_relocation_info {
873 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
874 uint32_t r_scattered:1,
880 uint32_t r_address:24,
889 // Structs NOT from <mach-o/reloc.h>, but that make LLVM's life easier
890 struct any_relocation_info {
891 uint32_t r_word0, r_word1;
894 // Structs from <mach-o/nlist.h>
911 // Get/Set functions from <mach-o/nlist.h>
913 static inline uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc) {
914 return (((n_desc) >> 8u) & 0xffu);
917 static inline void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal) {
918 n_desc = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
921 static inline uint8_t GET_COMM_ALIGN (uint16_t n_desc) {
922 return (n_desc >> 8u) & 0x0fu;
925 static inline void SET_COMM_ALIGN (uint16_t &n_desc, uint8_t align) {
926 n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
929 // Enums from <mach/machine.h>
931 // Capability bits used in the definition of cpu_type.
932 CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits
933 CPU_ARCH_ABI64 = 0x01000000 // 64 bit ABI
936 // Constants for the cputype field.
940 CPU_TYPE_I386 = CPU_TYPE_X86,
941 CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64,
942 /* CPU_TYPE_MIPS = 8, */
943 CPU_TYPE_MC98000 = 10, // Old Motorola PowerPC
945 CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64,
947 CPU_TYPE_POWERPC = 18,
948 CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64
952 // Capability bits used in the definition of cpusubtype.
953 CPU_SUB_TYPE_MASK = 0xff000000, // Mask for architecture bits
954 CPU_SUB_TYPE_LIB64 = 0x80000000, // 64 bit libraries
956 // Special CPU subtype constants.
957 CPU_SUBTYPE_MULTIPLE = ~0u
960 // Constants for the cpusubtype field.
962 CPU_SUBTYPE_I386_ALL = 3,
965 CPU_SUBTYPE_486SX = 0x84,
967 CPU_SUBTYPE_PENT = CPU_SUBTYPE_586,
968 CPU_SUBTYPE_PENTPRO = 0x16,
969 CPU_SUBTYPE_PENTII_M3 = 0x36,
970 CPU_SUBTYPE_PENTII_M5 = 0x56,
971 CPU_SUBTYPE_CELERON = 0x67,
972 CPU_SUBTYPE_CELERON_MOBILE = 0x77,
973 CPU_SUBTYPE_PENTIUM_3 = 0x08,
974 CPU_SUBTYPE_PENTIUM_3_M = 0x18,
975 CPU_SUBTYPE_PENTIUM_3_XEON = 0x28,
976 CPU_SUBTYPE_PENTIUM_M = 0x09,
977 CPU_SUBTYPE_PENTIUM_4 = 0x0a,
978 CPU_SUBTYPE_PENTIUM_4_M = 0x1a,
979 CPU_SUBTYPE_ITANIUM = 0x0b,
980 CPU_SUBTYPE_ITANIUM_2 = 0x1b,
981 CPU_SUBTYPE_XEON = 0x0c,
982 CPU_SUBTYPE_XEON_MP = 0x1c,
984 CPU_SUBTYPE_X86_ALL = 3,
985 CPU_SUBTYPE_X86_64_ALL = 3,
986 CPU_SUBTYPE_X86_ARCH1 = 4,
987 CPU_SUBTYPE_X86_64_H = 8
989 static inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
990 return Family | (Model << 4);
992 static inline int CPU_SUBTYPE_INTEL_FAMILY(CPUSubTypeX86 ST) {
993 return ((int)ST) & 0x0f;
995 static inline int CPU_SUBTYPE_INTEL_MODEL(CPUSubTypeX86 ST) {
996 return ((int)ST) >> 4;
999 CPU_SUBTYPE_INTEL_FAMILY_MAX = 15,
1000 CPU_SUBTYPE_INTEL_MODEL_ALL = 0
1003 enum CPUSubTypeARM {
1004 CPU_SUBTYPE_ARM_ALL = 0,
1005 CPU_SUBTYPE_ARM_V4T = 5,
1006 CPU_SUBTYPE_ARM_V6 = 6,
1007 CPU_SUBTYPE_ARM_V5 = 7,
1008 CPU_SUBTYPE_ARM_V5TEJ = 7,
1009 CPU_SUBTYPE_ARM_XSCALE = 8,
1010 CPU_SUBTYPE_ARM_V7 = 9,
1011 // unused ARM_V7F = 10,
1012 CPU_SUBTYPE_ARM_V7S = 11,
1013 CPU_SUBTYPE_ARM_V7K = 12,
1014 CPU_SUBTYPE_ARM_V6M = 14,
1015 CPU_SUBTYPE_ARM_V7M = 15,
1016 CPU_SUBTYPE_ARM_V7EM = 16
1019 enum CPUSubTypeARM64 {
1020 CPU_SUBTYPE_ARM64_ALL = 0
1023 enum CPUSubTypeSPARC {
1024 CPU_SUBTYPE_SPARC_ALL = 0
1027 enum CPUSubTypePowerPC {
1028 CPU_SUBTYPE_POWERPC_ALL = 0,
1029 CPU_SUBTYPE_POWERPC_601 = 1,
1030 CPU_SUBTYPE_POWERPC_602 = 2,
1031 CPU_SUBTYPE_POWERPC_603 = 3,
1032 CPU_SUBTYPE_POWERPC_603e = 4,
1033 CPU_SUBTYPE_POWERPC_603ev = 5,
1034 CPU_SUBTYPE_POWERPC_604 = 6,
1035 CPU_SUBTYPE_POWERPC_604e = 7,
1036 CPU_SUBTYPE_POWERPC_620 = 8,
1037 CPU_SUBTYPE_POWERPC_750 = 9,
1038 CPU_SUBTYPE_POWERPC_7400 = 10,
1039 CPU_SUBTYPE_POWERPC_7450 = 11,
1040 CPU_SUBTYPE_POWERPC_970 = 100,
1042 CPU_SUBTYPE_MC980000_ALL = CPU_SUBTYPE_POWERPC_ALL,
1043 CPU_SUBTYPE_MC98601 = CPU_SUBTYPE_POWERPC_601
1045 } // end namespace MachO
1046 } // end namespace llvm