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/DataTypes.h"
19 // NOTE: The enums in this file are intentially named to be different than those
20 // in the headers in /usr/include/mach (on darwin systems) to avoid conflicts
24 // Enums from <mach-o/loader.h>
26 // Constants for the "magic" field in llvm::MachO::mach_header and
27 // llvm::MachO::mach_header_64
28 HeaderMagic32 = 0xFEEDFACEu, // MH_MAGIC
29 HeaderMagic32Swapped = 0xCEFAEDFEu, // MH_CIGAM
30 HeaderMagic64 = 0xFEEDFACFu, // MH_MAGIC_64
31 HeaderMagic64Swapped = 0xCFFAEDFEu, // MH_CIGAM_64
32 UniversalMagic = 0xCAFEBABEu, // FAT_MAGIC
33 UniversalMagicSwapped = 0xBEBAFECAu, // FAT_CIGAM
35 // Constants for the "filetype" field in llvm::MachO::mach_header and
36 // llvm::MachO::mach_header_64
37 HeaderFileTypeObject = 0x1u, // MH_OBJECT
38 HeaderFileTypeExecutable = 0x2u, // MH_EXECUTE
39 HeaderFileTypeFixedVMShlib = 0x3u, // MH_FVMLIB
40 HeaderFileTypeCore = 0x4u, // MH_CORE
41 HeaderFileTypePreloadedExecutable = 0x5u, // MH_PRELOAD
42 HeaderFileTypeDynamicShlib = 0x6u, // MH_DYLIB
43 HeaderFileTypeDynamicLinkEditor = 0x7u, // MH_DYLINKER
44 HeaderFileTypeBundle = 0x8u, // MH_BUNDLE
45 HeaderFileTypeDynamicShlibStub = 0x9u, // MH_DYLIB_STUB
46 HeaderFileTypeDSYM = 0xAu, // MH_DSYM
47 HeaderFileTypeKextBundle = 0xBu, // MH_KEXT_BUNDLE
49 // Constant bits for the "flags" field in llvm::MachO::mach_header and
50 // llvm::MachO::mach_header_64
51 HeaderFlagBitNoUndefinedSymbols = 0x00000001u, // MH_NOUNDEFS
52 HeaderFlagBitIsIncrementalLinkObject= 0x00000002u, // MH_INCRLINK
53 HeaderFlagBitIsDynamicLinkObject = 0x00000004u, // MH_DYLDLINK
54 HeaderFlagBitBindAtLoad = 0x00000008u, // MH_BINDATLOAD
55 HeaderFlagBitPrebound = 0x00000010u, // MH_PREBOUND
56 HeaderFlagBitSplitSegments = 0x00000020u, // MH_SPLIT_SEGS
57 HeaderFlagBitLazyInit = 0x00000040u, // MH_LAZY_INIT
58 HeaderFlagBitTwoLevelNamespace = 0x00000080u, // MH_TWOLEVEL
59 HeaderFlagBitForceFlatNamespace = 0x00000100u, // MH_FORCE_FLAT
60 HeaderFlagBitNoMultipleDefintions = 0x00000200u, // MH_NOMULTIDEFS
61 HeaderFlagBitNoFixPrebinding = 0x00000400u, // MH_NOFIXPREBINDING
62 HeaderFlagBitPrebindable = 0x00000800u, // MH_PREBINDABLE
63 HeaderFlagBitAllModulesBound = 0x00001000u, // MH_ALLMODSBOUND
64 HeaderFlagBitSubsectionsViaSymbols = 0x00002000u, // MH_SUBSECTIONS_VIA_SYMBOLS
65 HeaderFlagBitCanonical = 0x00004000u, // MH_CANONICAL
66 HeaderFlagBitWeakDefines = 0x00008000u, // MH_WEAK_DEFINES
67 HeaderFlagBitBindsToWeak = 0x00010000u, // MH_BINDS_TO_WEAK
68 HeaderFlagBitAllowStackExecution = 0x00020000u, // MH_ALLOW_STACK_EXECUTION
69 HeaderFlagBitRootSafe = 0x00040000u, // MH_ROOT_SAFE
70 HeaderFlagBitSetUIDSafe = 0x00080000u, // MH_SETUID_SAFE
71 HeaderFlagBitNoReexportedDylibs = 0x00100000u, // MH_NO_REEXPORTED_DYLIBS
72 HeaderFlagBitPIE = 0x00200000u, // MH_PIE
73 HeaderFlagBitDeadStrippableDylib = 0x00400000u, // MH_DEAD_STRIPPABLE_DYLIB
75 // Constants for the "cmd" field in llvm::MachO::load_command
76 LoadCommandDynamicLinkerRequired = 0x80000000u, // LC_REQ_DYLD
77 LoadCommandSegment32 = 0x00000001u, // LC_SEGMENT
78 LoadCommandSymtab = 0x00000002u, // LC_SYMTAB
79 LoadCommandSymSeg = 0x00000003u, // LC_SYMSEG
80 LoadCommandThread = 0x00000004u, // LC_THREAD
81 LoadCommandUnixThread = 0x00000005u, // LC_UNIXTHREAD
82 LoadCommandFixedVMShlibLoad = 0x00000006u, // LC_LOADFVMLIB
83 LoadCommandFixedVMShlibIdent = 0x00000007u, // LC_IDFVMLIB
84 LoadCommandIdent = 0x00000008u, // LC_IDENT
85 LoadCommandFixedVMFileInclusion = 0x00000009u, // LC_FVMFILE
86 LoadCommandPrePage = 0x0000000Au, // LC_PREPAGE
87 LoadCommandDynamicSymtabInfo = 0x0000000Bu, // LC_DYSYMTAB
88 LoadCommandDylibLoad = 0x0000000Cu, // LC_LOAD_DYLIB
89 LoadCommandDylibIdent = 0x0000000Du, // LC_ID_DYLIB
90 LoadCommandDynamicLinkerLoad = 0x0000000Eu, // LC_LOAD_DYLINKER
91 LoadCommandDynamicLinkerIdent = 0x0000000Fu, // LC_ID_DYLINKER
92 LoadCommandDylibPrebound = 0x00000010u, // LC_PREBOUND_DYLIB
93 LoadCommandRoutines32 = 0x00000011u, // LC_ROUTINES
94 LoadCommandSubFramework = 0x00000012u, // LC_SUB_FRAMEWORK
95 LoadCommandSubUmbrella = 0x00000013u, // LC_SUB_UMBRELLA
96 LoadCommandSubClient = 0x00000014u, // LC_SUB_CLIENT
97 LoadCommandSubLibrary = 0x00000015u, // LC_SUB_LIBRARY
98 LoadCommandTwoLevelHints = 0x00000016u, // LC_TWOLEVEL_HINTS
99 LoadCommandPreBindChecksum = 0x00000017u, // LC_PREBIND_CKSUM
100 LoadCommandDylibLoadWeak = 0x80000018u, // LC_LOAD_WEAK_DYLIB
101 LoadCommandSegment64 = 0x00000019u, // LC_SEGMENT_64
102 LoadCommandRoutines64 = 0x0000001Au, // LC_ROUTINES_64
103 LoadCommandUUID = 0x0000001Bu, // LC_UUID
104 LoadCommandRunpath = 0x8000001Cu, // LC_RPATH
105 LoadCommandCodeSignature = 0x0000001Du, // LC_CODE_SIGNATURE
106 LoadCommandSegmentSplitInfo = 0x0000001Eu, // LC_SEGMENT_SPLIT_INFO
107 LoadCommandDylibReexport = 0x8000001Fu, // LC_REEXPORT_DYLIB
108 LoadCommandDylibLazyLoad = 0x00000020u, // LC_LAZY_LOAD_DYLIB
109 LoadCommandEncryptionInfo = 0x00000021u, // LC_ENCRYPTION_INFO
110 LoadCommandDynamicLinkerInfo = 0x00000022u, // LC_DYLD_INFO
111 LoadCommandDynamicLinkerInfoOnly = 0x80000022u, // LC_DYLD_INFO_ONLY
112 LoadCommandDylibLoadUpward = 0x80000023u, // LC_LOAD_UPWARD_DYLIB
113 LoadCommandVersionMinMacOSX = 0x00000024u, // LC_VERSION_MIN_MACOSX
114 LoadCommandVersionMinIPhoneOS = 0x00000025u, // LC_VERSION_MIN_IPHONEOS
115 LoadCommandFunctionStarts = 0x00000026u, // LC_FUNCTION_STARTS
116 LoadCommandDyldEnvironment = 0x00000027u, // LC_DYLD_ENVIRONMENT
117 LoadCommandMain = 0x80000028u, // LC_MAIN
118 LoadCommandDataInCode = 0x00000029u, // LC_DATA_IN_CODE
119 LoadCommandSourceVersion = 0x0000002Au, // LC_SOURCE_VERSION
120 LoadCommandCodeSignDRs = 0x0000002Bu, // LC_DYLIB_CODE_SIGN_DRS
122 // Constant bits for the "flags" field in llvm::MachO::segment_command
123 SegmentCommandFlagBitHighVM = 0x1u, // SG_HIGHVM
124 SegmentCommandFlagBitFixedVMLibrary = 0x2u, // SG_FVMLIB
125 SegmentCommandFlagBitNoRelocations = 0x4u, // SG_NORELOC
126 SegmentCommandFlagBitProtectedVersion1 = 0x8u, // SG_PROTECTED_VERSION_1
129 // Constant masks for the "flags" field in llvm::MachO::section and
130 // llvm::MachO::section_64
131 SectionFlagMaskSectionType = 0x000000ffu, // SECTION_TYPE
132 SectionFlagMaskAllAttributes = 0xffffff00u, // SECTION_ATTRIBUTES
133 SectionFlagMaskUserAttributes = 0xff000000u, // SECTION_ATTRIBUTES_USR
134 SectionFlagMaskSystemAttributes = 0x00ffff00u, // SECTION_ATTRIBUTES_SYS
136 // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
137 // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
138 SectionTypeRegular = 0x00u, // S_REGULAR
139 SectionTypeZeroFill = 0x01u, // S_ZEROFILL
140 SectionTypeCStringLiterals = 0x02u, // S_CSTRING_LITERALS
141 SectionType4ByteLiterals = 0x03u, // S_4BYTE_LITERALS
142 SectionType8ByteLiterals = 0x04u, // S_8BYTE_LITERALS
143 SectionTypeLiteralPointers = 0x05u, // S_LITERAL_POINTERS
144 SectionTypeNonLazySymbolPointers = 0x06u, // S_NON_LAZY_SYMBOL_POINTERS
145 SectionTypeLazySymbolPointers = 0x07u, // S_LAZY_SYMBOL_POINTERS
146 SectionTypeSymbolStubs = 0x08u, // S_SYMBOL_STUBS
147 SectionTypeModuleInitFunctionPointers = 0x09u, // S_MOD_INIT_FUNC_POINTERS
148 SectionTypeModuleTermFunctionPointers = 0x0au, // S_MOD_TERM_FUNC_POINTERS
149 SectionTypeCoalesced = 0x0bu, // S_COALESCED
150 SectionTypeZeroFillLarge = 0x0cu, // S_GB_ZEROFILL
151 SectionTypeInterposing = 0x0du, // S_INTERPOSING
152 SectionType16ByteLiterals = 0x0eu, // S_16BYTE_LITERALS
153 SectionTypeDTraceObjectFormat = 0x0fu, // S_DTRACE_DOF
154 SectionTypeLazyDylibSymbolPointers = 0x10u, // S_LAZY_DYLIB_SYMBOL_POINTERS
156 // Constant masks for the "flags[31:24]" field in llvm::MachO::section and
157 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
158 SectionAttrUserPureInstructions = 0x80000000u, // S_ATTR_PURE_INSTRUCTIONS
159 SectionAttrUserNoTableOfContents = 0x40000000u, // S_ATTR_NO_TOC
160 SectionAttrUserCanStripStaticSymbols = 0x20000000u, // S_ATTR_STRIP_STATIC_SYMS
161 SectionAttrUserNoDeadStrip = 0x10000000u, // S_ATTR_NO_DEAD_STRIP
162 SectionAttrUserLiveSupport = 0x08000000u, // S_ATTR_LIVE_SUPPORT
163 SectionAttrUserSelfModifyingCode = 0x04000000u, // S_ATTR_SELF_MODIFYING_CODE
164 SectionAttrUserDebug = 0x02000000u, // S_ATTR_DEBUG
166 // Constant masks for the "flags[23:8]" field in llvm::MachO::section and
167 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
168 SectionAttrSytemSomeInstructions = 0x00000400u, // S_ATTR_SOME_INSTRUCTIONS
169 SectionAttrSytemHasExternalRelocations= 0x00000200u, // S_ATTR_EXT_RELOC
170 SectionAttrSytemHasLocalRelocations = 0x00000100u, // S_ATTR_LOC_RELOC
172 IndirectSymbolLocal = 0x80000000u, // INDIRECT_SYMBOL_LOCAL
173 IndirectSymbolAbsolute = 0x40000000u, // INDIRECT_SYMBOL_ABS
175 RebaseTypePointer = 1u, // REBASE_TYPE_POINTER
176 RebaseTypeTextAbsolute32 = 2u, // REBASE_TYPE_TEXT_ABSOLUTE32
177 RebaseTypeTextPCRelative32 = 3u, // REBASE_TYPE_TEXT_PCREL32
179 RebaseOpcodeMask = 0xF0u, // REBASE_OPCODE_MASK
180 RebaseImmediateMask = 0x0Fu, // REBASE_IMMEDIATE_MASK
181 RebaseOpcodeDone = 0x00u, // REBASE_OPCODE_DONE
182 RebaseOpcodeSetTypeImmediate = 0x10u, // REBASE_OPCODE_SET_TYPE_IMM
183 RebaseOpcodeSetSegmentAndOffsetULEB = 0x20u, // REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
184 RebaseOpcodeAddAddressULEB = 0x30u, // REBASE_OPCODE_ADD_ADDR_ULEB
185 RebaseOpcodeAddAddressImmediateScaled = 0x40u, // REBASE_OPCODE_ADD_ADDR_IMM_SCALED
186 RebaseOpcodeDoRebaseImmediateTimes = 0x50u, // REBASE_OPCODE_DO_REBASE_IMM_TIMES
187 RebaseOpcodeDoRebaseULEBTimes = 0x60u, // REBASE_OPCODE_DO_REBASE_ULEB_TIMES
188 RebaseOpcodeDoRebaseAddAddressULEB = 0x70u, // REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
189 RebaseOpcodeDoRebaseULEBTimesSkippingULEB = 0x80u, // REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
192 BindTypePointer = 1u, // BIND_TYPE_POINTER
193 BindTypeTextAbsolute32 = 2u, // BIND_TYPE_TEXT_ABSOLUTE32
194 BindTypeTextPCRelative32 = 3u, // BIND_TYPE_TEXT_PCREL32
196 BindSpecialDylibSelf = 0u, // BIND_SPECIAL_DYLIB_SELF
197 BindSpecialDylibMainExecutable = -1u, // BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE
198 BindSpecialDylibFlatLookup = -2u, // BIND_SPECIAL_DYLIB_FLAT_LOOKUP
200 BindSymbolFlagsWeakImport = 0x1u, // BIND_SYMBOL_FLAGS_WEAK_IMPORT
201 BindSymbolFlagsNonWeakDefinition = 0x8u, // BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION
203 BindOpcodeMask = 0xF0u, // BIND_OPCODE_MASK
204 BindImmediateMask = 0x0Fu, // BIND_IMMEDIATE_MASK
205 BindOpcodeDone = 0x00u, // BIND_OPCODE_DONE
206 BindOpcodeSetDylibOrdinalImmediate = 0x10u, // BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
207 BindOpcodeSetDylibOrdinalULEB = 0x20u, // BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB
208 BindOpcodeSetDylibSpecialImmediate = 0x30u, // BIND_OPCODE_SET_DYLIB_SPECIAL_IMM
209 BindOpcodeSetSymbolTrailingFlagsImmediate = 0x40u, // BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
210 BindOpcodeSetTypeImmediate = 0x50u, // BIND_OPCODE_SET_TYPE_IMM
211 BindOpcodeSetAppendSLEB = 0x60u, // BIND_OPCODE_SET_ADDEND_SLEB
212 BindOpcodeSetSegmentAndOffsetULEB = 0x70u, // BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
213 BindOpcodeAddAddressULEB = 0x80u, // BIND_OPCODE_ADD_ADDR_ULEB
214 BindOpcodeDoBind = 0x90u, // BIND_OPCODE_DO_BIND
215 BindOpcodeDoBindAddAddressULEB = 0xA0u, // BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB
216 BindOpcodeDoBindAddAddressImmediateScaled = 0xB0u, // BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED
217 BindOpcodeDoBindULEBTimesSkippingULEB = 0xC0u, // BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB
219 ExportSymbolFlagsKindMask = 0x03u, // EXPORT_SYMBOL_FLAGS_KIND_MASK
220 ExportSymbolFlagsKindRegular = 0x00u, // EXPORT_SYMBOL_FLAGS_KIND_REGULAR
221 ExportSymbolFlagsKindThreadLocal = 0x01u, // EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL
222 ExportSymbolFlagsWeakDefinition = 0x04u, // EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION
223 ExportSymbolFlagsIndirectDefinition = 0x08u, // EXPORT_SYMBOL_FLAGS_INDIRECT_DEFINITION
224 ExportSymbolFlagsHasSpecializations = 0x10u, // EXPORT_SYMBOL_FLAGS_HAS_SPECIALIZATIONS
227 // Constant masks for the "n_type" field in llvm::MachO::nlist and
228 // llvm::MachO::nlist_64
229 NlistMaskStab = 0xe0, // N_STAB
230 NlistMaskPrivateExternal = 0x10, // N_PEXT
231 NlistMaskType = 0x0e, // N_TYPE
232 NlistMaskExternal = 0x01, // N_EXT
234 // Constants for the "n_type & N_TYPE" llvm::MachO::nlist and
235 // llvm::MachO::nlist_64
236 NListTypeUndefined = 0x0u, // N_UNDF
237 NListTypeAbsolute = 0x2u, // N_ABS
238 NListTypeSection = 0xeu, // N_SECT
239 NListTypePreboundUndefined = 0xcu, // N_PBUD
240 NListTypeIndirect = 0xau, // N_INDR
242 // Constant masks for the "n_sect" field in llvm::MachO::nlist and
243 // llvm::MachO::nlist_64
244 NListSectionNoSection = 0u, // NO_SECT
245 NListSectionMaxSection = 0xffu, // MAX_SECT
247 NListDescWeakRef = 0x40u,
248 NListDescWeakDef = 0x80u,
250 // Constant values for the "n_type" field in llvm::MachO::nlist and
251 // llvm::MachO::nlist_64 when "(n_type & NlistMaskStab) != 0"
252 StabGlobalSymbol = 0x20u, // N_GSYM
253 StabFunctionName = 0x22u, // N_FNAME
254 StabFunction = 0x24u, // N_FUN
255 StabStaticSymbol = 0x26u, // N_STSYM
256 StabLocalCommon = 0x28u, // N_LCSYM
257 StabBeginSymbol = 0x2Eu, // N_BNSYM
258 StabSourceFileOptions = 0x3Cu, // N_OPT
259 StabRegisterSymbol = 0x40u, // N_RSYM
260 StabSourceLine = 0x44u, // N_SLINE
261 StabEndSymbol = 0x4Eu, // N_ENSYM
262 StabStructureType = 0x60u, // N_SSYM
263 StabSourceFileName = 0x64u, // N_SO
264 StabObjectFileName = 0x66u, // N_OSO
265 StabLocalSymbol = 0x80u, // N_LSYM
266 StabBeginIncludeFileName = 0x82u, // N_BINCL
267 StabIncludeFileName = 0x84u, // N_SOL
268 StabCompilerParameters = 0x86u, // N_PARAMS
269 StabCompilerVersion = 0x88u, // N_VERSION
270 StabCompilerOptLevel = 0x8Au, // N_OLEVEL
271 StabParameter = 0xA0u, // N_PSYM
272 StabEndIncludeFile = 0xA2u, // N_EINCL
273 StabAlternateEntry = 0xA4u, // N_ENTRY
274 StabLeftBracket = 0xC0u, // N_LBRAC
275 StabDeletedIncludeFile = 0xC2u, // N_EXCL
276 StabRightBracket = 0xE0u, // N_RBRAC
277 StabBeginCommon = 0xE2u, // N_BCOMM
278 StabEndCommon = 0xE4u, // N_ECOMM
279 StabEndCommonLocal = 0xE8u, // N_ECOML
280 StabLength = 0xFEu // N_LENG
284 // Structs from <mach-o/loader.h>
296 struct mach_header_64 {
307 struct load_command {
312 struct segment_command {
326 struct segment_command_64 {
371 uint32_t minor_version;
372 uint32_t header_addr;
375 struct fvmlib_command {
378 struct fvmlib fvmlib;
384 uint32_t current_version;
385 uint32_t compatibility_version;
388 struct dylib_command {
394 struct sub_framework_command {
400 struct sub_client_command {
406 struct sub_umbrella_command {
409 uint32_t sub_umbrella;
412 struct sub_library_command {
415 uint32_t sub_library;
418 struct prebound_dylib_command {
423 uint32_t linked_modules;
426 struct dylinker_command {
432 struct thread_command {
437 struct routines_command {
440 uint32_t init_address;
441 uint32_t init_module;
450 struct routines_command_64 {
453 uint64_t init_address;
454 uint64_t init_module;
463 struct symtab_command {
472 struct dysymtab_command {
485 uint32_t extrefsymoff;
486 uint32_t nextrefsyms;
487 uint32_t indirectsymoff;
488 uint32_t nindirectsyms;
495 struct dylib_table_of_contents {
496 uint32_t symbol_index;
497 uint32_t module_index;
500 struct dylib_module {
501 uint32_t module_name;
510 uint32_t iinit_iterm;
511 uint32_t ninit_nterm;
512 uint32_t objc_module_info_addr;
513 uint32_t objc_module_info_size;
516 struct dylib_module_64 {
517 uint32_t module_name;
526 uint32_t iinit_iterm;
527 uint32_t ninit_nterm;
528 uint32_t objc_module_info_size;
529 uint64_t objc_module_info_addr;
532 struct dylib_reference {
538 struct twolevel_hints_command {
545 struct twolevel_hint {
546 uint32_t isub_image:8,
550 struct prebind_cksum_command {
556 struct uuid_command {
562 struct rpath_command {
568 struct linkedit_data_command {
575 struct encryption_info_command {
583 struct version_min_command {
590 struct dyld_info_command {
594 uint32_t rebase_size;
597 uint32_t weak_bind_off;
598 uint32_t weak_bind_size;
599 uint32_t lazy_bind_off;
600 uint32_t lazy_bind_size;
602 uint32_t export_size;
605 struct symseg_command {
612 struct ident_command {
617 struct fvmfile_command {
621 uint32_t header_addr;
625 // Structs from <mach-o/fat.h>
639 // Structs from <mach-o/fat.h>
656 // Get/Set functions from <mach-o/nlist.h>
658 static inline uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc)
660 return (((n_desc) >> 8u) & 0xffu);
663 static inline void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal)
665 n_desc = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
668 static inline uint8_t GET_COMM_ALIGN (uint16_t n_desc)
670 return (n_desc >> 8u) & 0x0fu;
673 static inline void SET_COMM_ALIGN (uint16_t &n_desc, uint8_t align)
675 n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
678 // Enums from <mach/machine.h>
680 // Capability bits used in the definition of cpu_type.
681 CPUArchMask = 0xff000000, // Mask for architecture bits
682 CPUArchABI64 = 0x01000000, // 64 bit ABI
684 // Constants for the cputype field.
686 CPUTypeX86_64 = CPUTypeI386 | CPUArchABI64,
690 CPUTypePowerPC64 = CPUTypePowerPC | CPUArchABI64,
693 // Constants for the cpusubtype field.
696 CPUSubType_I386_ALL = 3,
697 CPUSubType_X86_64_ALL = 3,
700 CPUSubType_ARM_ALL = 0,
701 CPUSubType_ARM_V4T = 5,
702 CPUSubType_ARM_V5 = 7,
703 CPUSubType_ARM_V6 = 6,
704 CPUSubType_ARM_V7 = 9,
707 CPUSubType_POWERPC_ALL = 0,
709 CPUSubType_SPARC_ALL = 0
711 } // end namespace MachO
712 } // end namespace llvm