LLVM 23.0.0git
MachO.h
Go to the documentation of this file.
1//===-- llvm/BinaryFormat/MachO.h - The MachO file format -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines manifest constants for the MachO object file format.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_BINARYFORMAT_MACHO_H
14#define LLVM_BINARYFORMAT_MACHO_H
15
18#include "llvm/Support/Error.h"
20
21namespace llvm {
22
23class Triple;
24
25namespace MachO {
26// Enums from <mach-o/loader.h>
27enum : uint32_t {
28 // Constants for the "magic" field in llvm::MachO::mach_header and
29 // llvm::MachO::mach_header_64
30 MH_MAGIC = 0xFEEDFACEu,
31 MH_CIGAM = 0xCEFAEDFEu,
32 MH_MAGIC_64 = 0xFEEDFACFu,
33 MH_CIGAM_64 = 0xCFFAEDFEu,
34 FAT_MAGIC = 0xCAFEBABEu,
35 FAT_CIGAM = 0xBEBAFECAu,
36 FAT_MAGIC_64 = 0xCAFEBABFu,
37 FAT_CIGAM_64 = 0xBFBAFECAu
38};
39
41 // Constants for the "filetype" field in llvm::MachO::mach_header and
42 // llvm::MachO::mach_header_64
43 MH_OBJECT = 0x1u,
44 MH_EXECUTE = 0x2u,
45 MH_FVMLIB = 0x3u,
46 MH_CORE = 0x4u,
47 MH_PRELOAD = 0x5u,
48 MH_DYLIB = 0x6u,
50 MH_BUNDLE = 0x8u,
52 MH_DSYM = 0xAu,
54 MH_FILESET = 0xCu,
55};
56
57enum {
58 // Constant bits for the "flags" field in llvm::MachO::mach_header and
59 // llvm::MachO::mach_header_64
60 MH_NOUNDEFS = 0x00000001u,
61 MH_INCRLINK = 0x00000002u,
62 MH_DYLDLINK = 0x00000004u,
63 MH_BINDATLOAD = 0x00000008u,
64 MH_PREBOUND = 0x00000010u,
65 MH_SPLIT_SEGS = 0x00000020u,
66 MH_LAZY_INIT = 0x00000040u,
67 MH_TWOLEVEL = 0x00000080u,
68 MH_FORCE_FLAT = 0x00000100u,
69 MH_NOMULTIDEFS = 0x00000200u,
70 MH_NOFIXPREBINDING = 0x00000400u,
71 MH_PREBINDABLE = 0x00000800u,
72 MH_ALLMODSBOUND = 0x00001000u,
74 MH_CANONICAL = 0x00004000u,
75 MH_WEAK_DEFINES = 0x00008000u,
76 MH_BINDS_TO_WEAK = 0x00010000u,
78 MH_ROOT_SAFE = 0x00040000u,
79 MH_SETUID_SAFE = 0x00080000u,
81 MH_PIE = 0x00200000u,
84 MH_NO_HEAP_EXECUTION = 0x01000000u,
85 MH_APP_EXTENSION_SAFE = 0x02000000u,
87 MH_SIM_SUPPORT = 0x08000000u,
88 MH_DYLIB_IN_CACHE = 0x80000000u,
89};
90
91enum : uint32_t {
92 // Flags for the "cmd" field in llvm::MachO::load_command
93 LC_REQ_DYLD = 0x80000000u
94};
95
96#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) LCName = LCValue,
97
99#include "llvm/BinaryFormat/MachO.def"
100};
101
102#undef HANDLE_LOAD_COMMAND
103
104enum : uint32_t {
105 // Constant bits for the "flags" field in llvm::MachO::segment_command
106 SG_HIGHVM = 0x1u,
107 SG_FVMLIB = 0x2u,
111
112 // Constant masks for the "flags" field in llvm::MachO::section and
113 // llvm::MachO::section_64
114 SECTION_TYPE = 0x000000ffu, // SECTION_TYPE
115 SECTION_ATTRIBUTES = 0xffffff00u, // SECTION_ATTRIBUTES
116 SECTION_ATTRIBUTES_USR = 0xff000000u, // SECTION_ATTRIBUTES_USR
117 SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
118};
119
120/// These are the section type and attributes fields. A MachO section can
121/// have only one Type, but can have any of the attributes specified.
123 // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
124 // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
125
126 /// S_REGULAR - Regular section.
127 S_REGULAR = 0x00u,
128 /// S_ZEROFILL - Zero fill on demand section.
129 S_ZEROFILL = 0x01u,
130 /// S_CSTRING_LITERALS - Section with literal C strings.
132 /// S_4BYTE_LITERALS - Section with 4 byte literals.
134 /// S_8BYTE_LITERALS - Section with 8 byte literals.
136 /// S_LITERAL_POINTERS - Section with pointers to literals.
138 /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
140 /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
142 /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
143 /// the Reserved2 field.
145 /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
146 /// initialization.
148 /// S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for
149 /// termination.
151 /// S_COALESCED - Section contains symbols that are to be coalesced.
152 S_COALESCED = 0x0bu,
153 /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
154 /// gigabytes).
156 /// S_INTERPOSING - Section with only pairs of function pointers for
157 /// interposing.
159 /// S_16BYTE_LITERALS - Section with only 16 byte literals.
161 /// S_DTRACE_DOF - Section contains DTrace Object Format.
163 /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
164 /// lazy loaded dylibs.
166 /// S_THREAD_LOCAL_REGULAR - Thread local data section.
168 /// S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
170 /// S_THREAD_LOCAL_VARIABLES - Section with thread local variable
171 /// structure data.
173 /// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread
174 /// local structures.
176 /// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
177 /// variable initialization pointers to functions.
179 /// S_INIT_FUNC_OFFSETS - Section with 32-bit offsets to initializer
180 /// functions.
182
184};
185
186enum : uint32_t {
187 // Constant masks for the "flags[31:24]" field in llvm::MachO::section and
188 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
189
190 /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
191 /// instructions.
193 /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
194 /// in a ranlib table of contents.
195 S_ATTR_NO_TOC = 0x40000000u,
196 /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
197 /// in files with the MY_DYLDLINK flag.
199 /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
200 S_ATTR_NO_DEAD_STRIP = 0x10000000u,
201 /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
202 S_ATTR_LIVE_SUPPORT = 0x08000000u,
203 /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
204 /// dyld.
206 /// S_ATTR_DEBUG - A debug section.
207 S_ATTR_DEBUG = 0x02000000u,
208
209 // Constant masks for the "flags[23:8]" field in llvm::MachO::section and
210 // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
211
212 /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
214 /// S_ATTR_EXT_RELOC - Section has external relocation entries.
215 S_ATTR_EXT_RELOC = 0x00000200u,
216 /// S_ATTR_LOC_RELOC - Section has local relocation entries.
217 S_ATTR_LOC_RELOC = 0x00000100u,
218
219 // Constant masks for the value of an indirect symbol in an indirect
220 // symbol table
223};
224
226 // Constants for the "kind" field in a data_in_code_entry structure
232};
233
239
241
253
259
266
267enum {
270
273};
274
290
291enum {
296};
297
303
304enum {
305 // Constant masks for the "n_type" field in llvm::MachO::nlist and
306 // llvm::MachO::nlist_64
307 N_STAB = 0xe0,
308 N_PEXT = 0x10,
309 N_TYPE = 0x0e,
310 N_EXT = 0x01
311};
312
314 // Constants for the "n_type & N_TYPE" llvm::MachO::nlist and
315 // llvm::MachO::nlist_64
316 N_UNDF = 0x0u,
317 N_ABS = 0x2u,
318 N_SECT = 0xeu,
319 N_PBUD = 0xcu,
320 N_INDR = 0xau
321};
322
324 // Constants for the "n_sect" field in llvm::MachO::nlist and
325 // llvm::MachO::nlist_64
327 MAX_SECT = 0xffu
328};
329
330enum {
331 // Constant masks for the "n_desc" field in llvm::MachO::nlist and
332 // llvm::MachO::nlist_64
333 // The low 3 bits are the for the REFERENCE_TYPE.
341 // Flag bits (some overlap with the library ordinal bits).
345 N_WEAK_REF = 0x0040u,
346 N_WEAK_DEF = 0x0080u,
348 N_ALT_ENTRY = 0x0200u,
349 N_COLD_FUNC = 0x0400u,
350 // For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL()
351 // as these are in the top 8 bits.
356};
357
359 // Constant values for the "n_type" field in llvm::MachO::nlist and
360 // llvm::MachO::nlist_64 when "(n_type & N_STAB) != 0"
361 N_GSYM = 0x20u,
362 N_FNAME = 0x22u,
363 N_FUN = 0x24u,
364 N_STSYM = 0x26u,
365 N_LCSYM = 0x28u,
366 N_BNSYM = 0x2Eu,
367 N_PC = 0x30u,
368 N_AST = 0x32u,
369 N_OPT = 0x3Cu,
370 N_RSYM = 0x40u,
371 N_SLINE = 0x44u,
372 N_ENSYM = 0x4Eu,
373 N_SSYM = 0x60u,
374 N_SO = 0x64u,
375 N_OSO = 0x66u,
376 N_LIB = 0x68u,
377 N_LSYM = 0x80u,
378 N_BINCL = 0x82u,
379 N_SOL = 0x84u,
380 N_PARAMS = 0x86u,
381 N_VERSION = 0x88u,
382 N_OLEVEL = 0x8Au,
383 N_PSYM = 0xA0u,
384 N_EINCL = 0xA2u,
385 N_ENTRY = 0xA4u,
386 N_LBRAC = 0xC0u,
387 N_EXCL = 0xC2u,
388 N_RBRAC = 0xE0u,
389 N_BCOMM = 0xE2u,
390 N_ECOMM = 0xE4u,
391 N_ECOML = 0xE8u,
392 N_LENG = 0xFEu
393};
394
395enum : uint32_t {
396 // Constant values for the r_symbolnum field in an
397 // llvm::MachO::relocation_info structure when r_extern is 0.
398 R_ABS = 0,
399
400 // Constant bits for the r_address field in an
401 // llvm::MachO::relocation_info structure.
402 R_SCATTERED = 0x80000000
403};
404
406 // Constant values for the r_type field in an
407 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
408 // structure.
416
417 // Constant values for the r_type field in a PowerPC architecture
418 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
419 // structure.
436
437 // Constant values for the r_type field in an ARM architecture
438 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
439 // structure.
447 ARM_THUMB_32BIT_BRANCH = 7, // obsolete
450
451 // Constant values for the r_type field in an ARM64 architecture
452 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
453 // structure.
454
455 // For pointers.
457 // Must be followed by an ARM64_RELOC_UNSIGNED
459 // A B/BL instruction with 26-bit displacement.
461 // PC-rel distance to page of target.
463 // Offset within page, scaled by r_length.
465 // PC-rel distance to page of GOT slot.
467 // Offset within page of GOT slot, scaled by r_length.
469 // For pointers to GOT slots.
471 // PC-rel distance to page of TLVP slot.
473 // Offset within page of TLVP slot, scaled by r_length.
475 // Must be followed by ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12.
477 // An authenticated pointer.
479
480 // For pointers. For example, for a .word directive in assembly
481 // representing a memory location where data is stored:
482 // .word: _bar
484 // Subtractor operand. Must be followed by a RISCV_RELOC_UNSIGNED,
485 // which is the pointer from which to subtract the subtractor. For
486 // example:
487 //
488 // .global _a
489 // .global _b
490 // _a: ...
491 // _b: ...
492 //
493 // .data_region
494 // .word _a - _b
495 // .end_data_region
497 // A jal/j instruction with 21-bit displacement. For example, a
498 // function call:
499 //
500 // _foo:
501 // jal _bar
503 // High 20 bits of pointer. r_pcrel=1 means this is paired with an
504 // AUIPC. r_pcrel=0 means this is paired with a LUI.
506 // An ADDI or LW/SW instruction that requires low 12 bits to be
507 // adjusted. r_pcrel=1 means this is paired with an AUIPC.
508 // r_pcrel=0 means this is paired with a LUI (llvm currently does
509 // not support no-PIC). Note: the compiler places the distance to
510 // the paired AUIPC in the imm12 (e.g. if previous instruction is
511 // the AUIPC, the imm12 is -4 or 0xFFC). NOTE: this mean that the
512 // separation between hi/lo has to fit in (signed) 12 bits. Beyond
513 // 12-bits, the pc-relative offset is not inlined in the imm12, but
514 // it is instead stored in the 24-bits of a RISCV_RELOC_ADDEND
515 // record.
517 // High 20 bits of GOT slot. r_pcrel=1 means this is paired with an
518 // AUIPC. r_pcrel=0 means this is paired with a LUI (the compiler
519 // may emit a @got reloc for a reference to anything outside the
520 // translation unit, then the linker elides the @got if the target
521 // is in range).
523 // Low 12 bits of GOT slot. r_pcrel=1 means this is paired with an
524 // AUIPC. r_pcrel=0 means this is paired with a LUI.
526 // For pointers to GOT slots. To be used by C++ exception handling,
527 // in the Language Specific Data Area (LSDA, __gcc_except_tab
528 // section). Not currently used, but added for completeness.
530 // Adds a static offset to a relocation. Must be followed by
531 // RISCV_RELOC_PCREL_HI, RISCV_RELOC_BRANCH21 or
532 // RISCV_RELOC_LO12. For example, the 16 bytes offset in:
533 //
534 // auipc a0, %pcrel_hi(var+16)
536
537 // Constant values for the r_type field in an x86_64 architecture
538 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
539 // structure
550};
551
552// Values for segment_command.initprot.
553// From <mach/vm_prot.h>
554enum { VM_PROT_READ = 0x1, VM_PROT_WRITE = 0x2, VM_PROT_EXECUTE = 0x4 };
555
556// Values for platform field in build_version_command.
558#define PLATFORM(platform, id, name, build_name, target, tapi_target, \
559 marketing) \
560 PLATFORM_##platform = id,
561#include "MachO.def"
562};
563
564// Values for tools enum in build_tool_version.
565enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3, TOOL_LLD = 4 };
566
567// Structs from <mach-o/loader.h>
568
578
589
594
608
622
636
651
652inline bool isVirtualSection(uint8_t type) {
653 return (type == MachO::S_ZEROFILL || type == MachO::S_GB_ZEROFILL ||
655}
656
662
663// The fvmlib_command is obsolete and no longer supported.
669
676
682
688
694
700
706
707// The prebound_dylib_command is obsolete and no longer supported.
715
721
726
739
752
761
784
789
805
821
823 uint32_t isym : 24, flags : 8;
824};
825
826// The twolevel_hints_command is obsolete and no longer supported.
833
834// The twolevel_hints_command is obsolete and no longer supported.
837};
838
839// The prebind_cksum_command is obsolete and no longer supported.
845
851
857
864
870
876
884
893
895 uint32_t cmd; // LC_VERSION_MIN_MACOSX or
896 // LC_VERSION_MIN_IPHONEOS
897 uint32_t cmdsize; // sizeof(struct version_min_command)
898 uint32_t version; // X.Y.Z is encoded in nibbles xxxx.yy.zz
899 uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
900};
901
903 uint32_t cmd; // LC_NOTE
904 uint32_t cmdsize; // sizeof(struct note_command)
905 char data_owner[16]; // owner name for this LC_NOTE
906 uint64_t offset; // file offset of this data
907 uint64_t size; // length of data region
908};
909
911 uint32_t tool; // enum for the tool
912 uint32_t version; // version of the tool
913};
914
916 uint32_t cmd; // LC_BUILD_VERSION
917 uint32_t cmdsize; // sizeof(struct build_version_command) +
918 // ntools * sizeof(struct build_tool_version)
919 uint32_t platform; // platform
920 uint32_t minos; // X.Y.Z is encoded in nibbles xxxx.yy.zz
921 uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
922 uint32_t ntools; // number of tool entries following this
923};
924
930
945
951
955
964
965// The symseg_command is obsolete and no longer supported.
972
973// The ident_command is obsolete and no longer supported.
978
979// The fvmfile_command is obsolete and no longer supported.
986
992
998
1000 uintptr_t thunk;
1001 uintptr_t key;
1002 uintptr_t offset;
1003};
1004
1011
1012// Structs from <mach-o/fat.h>
1017
1025
1034
1035// Structs from <mach-o/reloc.h>
1041
1043#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
1044 uint32_t r_scattered : 1, r_pcrel : 1, r_length : 2, r_type : 4,
1045 r_address : 24;
1046#else
1049#endif
1050 int32_t r_value;
1051};
1052
1053// Structs NOT from <mach-o/reloc.h>, but that make LLVM's life easier
1057
1058// Structs from <mach-o/nlist.h>
1065
1073
1081
1082// Values for dyld_chained_fixups_header::imports_format.
1088
1089// Values for dyld_chained_fixups_header::symbols_format.
1090enum {
1093};
1094
1095// Values for dyld_chained_starts_in_segment::page_start.
1096enum {
1098 DYLD_CHAINED_PTR_START_MULTI = 0x8000, // page which has multiple starts
1099 DYLD_CHAINED_PTR_START_LAST = 0x8000, // last chain_start for a given page
1100};
1101
1102// Values for dyld_chained_starts_in_segment::pointer_format.
1103enum {
1116};
1117
1118/// Structs for dyld chained fixups.
1119/// dyld_chained_fixups_header is the data pointed to by LC_DYLD_CHAINED_FIXUPS
1120/// load command.
1123 uint32_t starts_offset; ///< Offset of dyld_chained_starts_in_image.
1124 uint32_t imports_offset; ///< Offset of imports table in chain_data.
1125 uint32_t symbols_offset; ///< Offset of symbol strings in chain_data.
1126 uint32_t imports_count; ///< Number of imported symbol names.
1127 uint32_t imports_format; ///< DYLD_CHAINED_IMPORT*
1128 uint32_t symbols_format; ///< 0 => uncompressed, 1 => zlib compressed
1129};
1130
1131/// dyld_chained_starts_in_image is embedded in LC_DYLD_CHAINED_FIXUPS payload.
1132/// Each seg_info_offset entry is the offset into this struct for that
1133/// segment followed by pool of dyld_chain_starts_in_segment data.
1138
1140 uint32_t size; ///< Size of this, including chain_starts entries
1141 uint16_t page_size; ///< Page size in bytes (0x1000 or 0x4000)
1142 uint16_t pointer_format; ///< DYLD_CHAINED_PTR*
1143 uint64_t segment_offset; ///< VM offset from the __TEXT segment
1144 uint32_t max_valid_pointer; ///< Values beyond this are not pointers on 32-bit
1145 uint16_t page_count; ///< Length of the page_start array
1146 uint16_t page_start[1]; ///< Page offset of first fixup on each page, or
1147 ///< DYLD_CHAINED_PTR_START_NONE if no fixups
1148};
1149
1150// DYLD_CHAINED_IMPORT
1156
1157// DYLD_CHAINED_IMPORT_ADDEND
1164
1165// DYLD_CHAINED_IMPORT_ADDEND64
1173
1174// The `bind` field (most significant bit) of the encoded fixup determines
1175// whether it is dyld_chained_ptr_64_bind or dyld_chained_ptr_64_rebase.
1176
1177// DYLD_CHAINED_PTR_64/DYLD_CHAINED_PTR_64_OFFSET
1185
1186// DYLD_CHAINED_PTR_64/DYLD_CHAINED_PTR_64_OFFSET
1194
1195// Byte order swapping functions for MachO structs
1196
1197inline void swapStruct(fat_header &mh) {
1200}
1201
1209
1218
1228
1230 sys::swapByteOrder(H.magic);
1231 sys::swapByteOrder(H.cputype);
1232 sys::swapByteOrder(H.cpusubtype);
1233 sys::swapByteOrder(H.filetype);
1234 sys::swapByteOrder(H.ncmds);
1235 sys::swapByteOrder(H.sizeofcmds);
1236 sys::swapByteOrder(H.flags);
1237 sys::swapByteOrder(H.reserved);
1238}
1239
1240inline void swapStruct(load_command &lc) {
1243}
1244
1253
1266
1279
1291
1303
1306 sys::swapByteOrder(info.cmdsize);
1307 sys::swapByteOrder(info.rebase_off);
1308 sys::swapByteOrder(info.rebase_size);
1309 sys::swapByteOrder(info.bind_off);
1310 sys::swapByteOrder(info.bind_size);
1311 sys::swapByteOrder(info.weak_bind_off);
1312 sys::swapByteOrder(info.weak_bind_size);
1313 sys::swapByteOrder(info.lazy_bind_off);
1314 sys::swapByteOrder(info.lazy_bind_size);
1315 sys::swapByteOrder(info.export_off);
1316 sys::swapByteOrder(info.export_size);
1317}
1318
1327
1333
1339
1345
1351
1364
1377
1382
1388
1389inline void swapStruct(uuid_command &u) {
1390 sys::swapByteOrder(u.cmd);
1391 sys::swapByteOrder(u.cmdsize);
1392}
1393
1399
1405
1407 sys::swapByteOrder(e.cmd);
1408 sys::swapByteOrder(e.cmdsize);
1409 sys::swapByteOrder(e.entryoff);
1410 sys::swapByteOrder(e.stacksize);
1411}
1412
1414 sys::swapByteOrder(e.cmd);
1415 sys::swapByteOrder(e.cmdsize);
1416 sys::swapByteOrder(e.cryptoff);
1417 sys::swapByteOrder(e.cryptsize);
1418 sys::swapByteOrder(e.cryptid);
1419}
1420
1422 sys::swapByteOrder(e.cmd);
1423 sys::swapByteOrder(e.cmdsize);
1424 sys::swapByteOrder(e.cryptoff);
1425 sys::swapByteOrder(e.cryptsize);
1426 sys::swapByteOrder(e.cryptid);
1427 sys::swapByteOrder(e.pad);
1428}
1429
1452
1453inline void swapStruct(any_relocation_info &reloc) {
1456}
1457
1462
1463inline void swapStruct(nlist &sym) {
1467}
1468
1469inline void swapStruct(nlist_64 &sym) {
1473}
1474
1476 sys::swapByteOrder(C.cmd);
1477 sys::swapByteOrder(C.cmdsize);
1478 sys::swapByteOrder(C.dataoff);
1479 sys::swapByteOrder(C.datasize);
1480}
1481
1483 sys::swapByteOrder(C.cmd);
1484 sys::swapByteOrder(C.cmdsize);
1485 sys::swapByteOrder(C.count);
1486}
1487
1489 sys::swapByteOrder(C.cmd);
1490 sys::swapByteOrder(C.cmdsize);
1491 sys::swapByteOrder(C.vmaddr);
1492 sys::swapByteOrder(C.fileoff);
1493 sys::swapByteOrder(C.entry_id.offset);
1494 sys::swapByteOrder(C.reserved);
1495}
1496
1498 sys::swapByteOrder(C.cmd);
1499 sys::swapByteOrder(C.cmdsize);
1500 sys::swapByteOrder(C.version);
1501 sys::swapByteOrder(C.sdk);
1502}
1503
1505 sys::swapByteOrder(C.cmd);
1506 sys::swapByteOrder(C.cmdsize);
1507 sys::swapByteOrder(C.offset);
1508 sys::swapByteOrder(C.size);
1509}
1510
1512 sys::swapByteOrder(C.cmd);
1513 sys::swapByteOrder(C.cmdsize);
1514 sys::swapByteOrder(C.platform);
1515 sys::swapByteOrder(C.minos);
1516 sys::swapByteOrder(C.sdk);
1517 sys::swapByteOrder(C.ntools);
1518}
1519
1521 sys::swapByteOrder(C.tool);
1522 sys::swapByteOrder(C.version);
1523}
1524
1526 sys::swapByteOrder(C.offset);
1527 sys::swapByteOrder(C.length);
1528 sys::swapByteOrder(C.kind);
1529}
1530
1532
1533// The prebind_cksum_command is obsolete and no longer supported.
1535 sys::swapByteOrder(C.cmd);
1536 sys::swapByteOrder(C.cmdsize);
1537 sys::swapByteOrder(C.cksum);
1538}
1539
1540// The twolevel_hints_command is obsolete and no longer supported.
1542 sys::swapByteOrder(C.cmd);
1543 sys::swapByteOrder(C.cmdsize);
1544 sys::swapByteOrder(C.offset);
1545 sys::swapByteOrder(C.nhints);
1546}
1547
1548// The prebound_dylib_command is obsolete and no longer supported.
1550 sys::swapByteOrder(C.cmd);
1551 sys::swapByteOrder(C.cmdsize);
1552 sys::swapByteOrder(C.name);
1553 sys::swapByteOrder(C.nmodules);
1554 sys::swapByteOrder(C.linked_modules);
1555}
1556
1557// The fvmfile_command is obsolete and no longer supported.
1559 sys::swapByteOrder(C.cmd);
1560 sys::swapByteOrder(C.cmdsize);
1561 sys::swapByteOrder(C.name);
1562 sys::swapByteOrder(C.header_addr);
1563}
1564
1565// The symseg_command is obsolete and no longer supported.
1567 sys::swapByteOrder(C.cmd);
1568 sys::swapByteOrder(C.cmdsize);
1569 sys::swapByteOrder(C.offset);
1570 sys::swapByteOrder(C.size);
1571}
1572
1573// The ident_command is obsolete and no longer supported.
1575 sys::swapByteOrder(C.cmd);
1576 sys::swapByteOrder(C.cmdsize);
1577}
1578
1579inline void swapStruct(fvmlib &C) {
1580 sys::swapByteOrder(C.name);
1581 sys::swapByteOrder(C.minor_version);
1582 sys::swapByteOrder(C.header_addr);
1583}
1584
1585// The fvmlib_command is obsolete and no longer supported.
1587 sys::swapByteOrder(C.cmd);
1588 sys::swapByteOrder(C.cmdsize);
1589 swapStruct(C.fvmlib);
1590}
1591
1592// Get/Set functions from <mach-o/nlist.h>
1593
1595 return (((n_desc) >> 8u) & 0xffu);
1596}
1597
1598inline void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal) {
1599 n_desc = (((n_desc)&0x00ff) | (((ordinal)&0xff) << 8));
1600}
1601
1603 return (n_desc >> 8u) & 0x0fu;
1604}
1605
1606inline void SET_COMM_ALIGN(uint16_t &n_desc, uint8_t align) {
1607 n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
1608}
1609
1610// Enums from <mach/machine.h>
1611enum : uint32_t {
1612 // Capability bits used in the definition of cpu_type.
1613 CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits
1614 CPU_ARCH_ABI64 = 0x01000000, // 64 bit ABI
1615 CPU_ARCH_ABI64_32 = 0x02000000, // ILP32 ABI on 64-bit hardware
1616};
1617
1618// Constants for the cputype field.
1635
1636enum : uint32_t {
1637 // Capability bits used in the definition of cpusubtype.
1638 CPU_SUBTYPE_MASK = 0xff000000, // Mask for architecture bits
1639 CPU_SUBTYPE_LIB64 = 0x80000000, // 64 bit libraries
1640
1641 // Special CPU subtype constants.
1643};
1644
1645// Constants for the cpusubtype field.
1674inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
1675 return Family | (Model << 4);
1676}
1678 return ((int)ST) & 0x0f;
1679}
1680inline int CPU_SUBTYPE_INTEL_MODEL(CPUSubTypeX86 ST) { return ((int)ST) >> 4; }
1682
1698
1703
1704 // arm64e uses the capability bits to encode ptrauth ABI information.
1705 // Bit 63 marks the binary as Versioned.
1707 // Bit 62 marks the binary as using a kernel ABI.
1709 // Bits [59:56] hold the 4-bit ptrauth ABI version.
1711};
1712
1714 return (ST & CPU_SUBTYPE_ARM64E_PTRAUTH_MASK) >> 24;
1715}
1716
1717inline uint32_t
1719 bool PtrAuthKernelABIVersion) {
1720 assert((PtrAuthABIVersion <= 0xF) &&
1721 "ptrauth abi version must fit in 4 bits");
1723 (PtrAuthKernelABIVersion
1725 : 0) |
1726 (PtrAuthABIVersion << 24);
1727}
1728
1732
1736
1738
1740
1759
1763
1767 unsigned PtrAuthABIVersion,
1768 bool PtrAuthKernelABIVersion);
1769
1788
1812
1818
1825
1827 unsigned short invalid : 1, denorm : 1, zdiv : 1, ovrfl : 1, undfl : 1,
1828 precis : 1, : 2, pc : 2, rc : 2, : 1, : 3;
1829};
1830
1832 unsigned short invalid : 1, denorm : 1, zdiv : 1, ovrfl : 1, undfl : 1,
1833 precis : 1, stkflt : 1, errsumm : 1, c0 : 1, c1 : 1, c2 : 1, tos : 3,
1834 c3 : 1, busy : 1;
1835};
1836
1838 char mmst_reg[10];
1839 char mmst_rsrv[6];
1840};
1841
1843 char xmm_reg[16];
1844};
1845
1888
1895
1897 sys::swapByteOrder(x.eax);
1898 sys::swapByteOrder(x.ebx);
1899 sys::swapByteOrder(x.ecx);
1900 sys::swapByteOrder(x.edx);
1901 sys::swapByteOrder(x.edi);
1902 sys::swapByteOrder(x.esi);
1903 sys::swapByteOrder(x.ebp);
1904 sys::swapByteOrder(x.esp);
1905 sys::swapByteOrder(x.ss);
1906 sys::swapByteOrder(x.eflags);
1907 sys::swapByteOrder(x.eip);
1908 sys::swapByteOrder(x.cs);
1909 sys::swapByteOrder(x.ds);
1910 sys::swapByteOrder(x.es);
1911 sys::swapByteOrder(x.fs);
1912 sys::swapByteOrder(x.gs);
1913}
1914
1916 sys::swapByteOrder(x.rax);
1917 sys::swapByteOrder(x.rbx);
1918 sys::swapByteOrder(x.rcx);
1919 sys::swapByteOrder(x.rdx);
1920 sys::swapByteOrder(x.rdi);
1921 sys::swapByteOrder(x.rsi);
1922 sys::swapByteOrder(x.rbp);
1923 sys::swapByteOrder(x.rsp);
1924 sys::swapByteOrder(x.r8);
1925 sys::swapByteOrder(x.r9);
1926 sys::swapByteOrder(x.r10);
1927 sys::swapByteOrder(x.r11);
1928 sys::swapByteOrder(x.r12);
1929 sys::swapByteOrder(x.r13);
1930 sys::swapByteOrder(x.r14);
1931 sys::swapByteOrder(x.r15);
1932 sys::swapByteOrder(x.rip);
1933 sys::swapByteOrder(x.rflags);
1934 sys::swapByteOrder(x.cs);
1935 sys::swapByteOrder(x.fs);
1936 sys::swapByteOrder(x.gs);
1937}
1938
1940 sys::swapByteOrder(x.fpu_reserved[0]);
1941 sys::swapByteOrder(x.fpu_reserved[1]);
1942 // TODO swap: fp_control_t fpu_fcw;
1943 // TODO swap: fp_status_t fpu_fsw;
1944 sys::swapByteOrder(x.fpu_fop);
1945 sys::swapByteOrder(x.fpu_ip);
1946 sys::swapByteOrder(x.fpu_cs);
1947 sys::swapByteOrder(x.fpu_rsrv2);
1948 sys::swapByteOrder(x.fpu_dp);
1949 sys::swapByteOrder(x.fpu_ds);
1950 sys::swapByteOrder(x.fpu_rsrv3);
1951 sys::swapByteOrder(x.fpu_mxcsr);
1952 sys::swapByteOrder(x.fpu_mxcsrmask);
1953 sys::swapByteOrder(x.fpu_reserved1);
1954}
1955
1957 sys::swapByteOrder(x.trapno);
1958 sys::swapByteOrder(x.cpu);
1959 sys::swapByteOrder(x.err);
1960 sys::swapByteOrder(x.faultvaddr);
1961}
1962
1967
1975
1982
1989
1991 sys::swapByteOrder(x.flavor);
1992 sys::swapByteOrder(x.count);
1993}
1994
2009
2011 swapStruct(x.tsh);
2012 if (x.tsh.flavor == x86_THREAD_STATE64)
2013 swapStruct(x.uts.ts64);
2014}
2015
2017 swapStruct(x.fsh);
2018 if (x.fsh.flavor == x86_FLOAT_STATE64)
2019 swapStruct(x.ufs.fs64);
2020}
2021
2023 swapStruct(x.esh);
2024 if (x.esh.flavor == x86_EXCEPTION_STATE64)
2025 swapStruct(x.ues.es64);
2026}
2027
2029 sizeof(x86_thread_state32_t) / sizeof(uint32_t);
2030
2032 sizeof(x86_thread_state64_t) / sizeof(uint32_t);
2034 sizeof(x86_float_state64_t) / sizeof(uint32_t);
2036 sizeof(x86_exception_state64_t) / sizeof(uint32_t);
2037
2039 sizeof(x86_thread_state_t) / sizeof(uint32_t);
2041 sizeof(x86_float_state_t) / sizeof(uint32_t);
2043 sizeof(x86_exception_state_t) / sizeof(uint32_t);
2044
2052
2054 for (int i = 0; i < 13; i++)
2055 sys::swapByteOrder(x.r[i]);
2056 sys::swapByteOrder(x.sp);
2057 sys::swapByteOrder(x.lr);
2058 sys::swapByteOrder(x.pc);
2059 sys::swapByteOrder(x.cpsr);
2060}
2061
2071
2073 for (int i = 0; i < 29; i++)
2074 sys::swapByteOrder(x.x[i]);
2075 sys::swapByteOrder(x.fp);
2076 sys::swapByteOrder(x.lr);
2077 sys::swapByteOrder(x.sp);
2078 sys::swapByteOrder(x.pc);
2079 sys::swapByteOrder(x.cpsr);
2080}
2081
2086
2093
2095 sys::swapByteOrder(x.flavor);
2096 sys::swapByteOrder(x.count);
2097}
2098
2108
2110 swapStruct(x.tsh);
2111 if (x.tsh.flavor == ARM_THREAD_STATE)
2112 swapStruct(x.uts.ts32);
2113}
2114
2116 sizeof(arm_thread_state32_t) / sizeof(uint32_t);
2117
2119 sizeof(arm_thread_state64_t) / sizeof(uint32_t);
2120
2163
2165 sys::swapByteOrder(x.srr0);
2166 sys::swapByteOrder(x.srr1);
2167 sys::swapByteOrder(x.r0);
2168 sys::swapByteOrder(x.r1);
2169 sys::swapByteOrder(x.r2);
2170 sys::swapByteOrder(x.r3);
2171 sys::swapByteOrder(x.r4);
2172 sys::swapByteOrder(x.r5);
2173 sys::swapByteOrder(x.r6);
2174 sys::swapByteOrder(x.r7);
2175 sys::swapByteOrder(x.r8);
2176 sys::swapByteOrder(x.r9);
2177 sys::swapByteOrder(x.r10);
2178 sys::swapByteOrder(x.r11);
2179 sys::swapByteOrder(x.r12);
2180 sys::swapByteOrder(x.r13);
2181 sys::swapByteOrder(x.r14);
2182 sys::swapByteOrder(x.r15);
2183 sys::swapByteOrder(x.r16);
2184 sys::swapByteOrder(x.r17);
2185 sys::swapByteOrder(x.r18);
2186 sys::swapByteOrder(x.r19);
2187 sys::swapByteOrder(x.r20);
2188 sys::swapByteOrder(x.r21);
2189 sys::swapByteOrder(x.r22);
2190 sys::swapByteOrder(x.r23);
2191 sys::swapByteOrder(x.r24);
2192 sys::swapByteOrder(x.r25);
2193 sys::swapByteOrder(x.r26);
2194 sys::swapByteOrder(x.r27);
2195 sys::swapByteOrder(x.r28);
2196 sys::swapByteOrder(x.r29);
2197 sys::swapByteOrder(x.r30);
2198 sys::swapByteOrder(x.r31);
2199 sys::swapByteOrder(x.ct);
2200 sys::swapByteOrder(x.xer);
2201 sys::swapByteOrder(x.lr);
2202 sys::swapByteOrder(x.ctr);
2203 sys::swapByteOrder(x.mq);
2204 sys::swapByteOrder(x.vrsave);
2205}
2206
2211
2218
2220 sys::swapByteOrder(x.flavor);
2221 sys::swapByteOrder(x.count);
2222}
2223
2233
2235 swapStruct(x.tsh);
2236 if (x.tsh.flavor == PPC_THREAD_STATE)
2237 swapStruct(x.uts.ts32);
2238}
2239
2241 sizeof(ppc_thread_state32_t) / sizeof(uint32_t);
2242
2243// Define a union of all load command structs
2244#define LOAD_COMMAND_STRUCT(LCStruct) LCStruct LCStruct##_data;
2245
2247union alignas(4) macho_load_command {
2248#include "llvm/BinaryFormat/MachO.def"
2249};
2251
2253 sys::swapByteOrder(C.fixups_version);
2254 sys::swapByteOrder(C.starts_offset);
2255 sys::swapByteOrder(C.imports_offset);
2256 sys::swapByteOrder(C.symbols_offset);
2257 sys::swapByteOrder(C.imports_count);
2258 sys::swapByteOrder(C.imports_format);
2259 sys::swapByteOrder(C.symbols_format);
2260}
2261
2263 sys::swapByteOrder(C.seg_count);
2264 // getStructOrErr() cannot copy the variable-length seg_info_offset array.
2265 // Its elements must be byte swapped manually.
2266}
2267
2269 sys::swapByteOrder(C.size);
2270 sys::swapByteOrder(C.page_size);
2271 sys::swapByteOrder(C.pointer_format);
2272 sys::swapByteOrder(C.segment_offset);
2273 sys::swapByteOrder(C.max_valid_pointer);
2274 sys::swapByteOrder(C.page_count);
2275 // seg_info_offset entries must be byte swapped manually.
2276}
2277
2278/* code signing attributes of a process */
2279
2281 CS_VALID = 0x00000001, /* dynamically valid */
2282 CS_ADHOC = 0x00000002, /* ad hoc signed */
2283 CS_GET_TASK_ALLOW = 0x00000004, /* has get-task-allow entitlement */
2284 CS_INSTALLER = 0x00000008, /* has installer entitlement */
2285
2287 0x00000010, /* Library Validation required by Hardened System Policy */
2288 CS_INVALID_ALLOWED = 0x00000020, /* (macOS Only) Page invalidation allowed by
2289 task port policy */
2290
2291 CS_HARD = 0x00000100, /* don't load invalid pages */
2292 CS_KILL = 0x00000200, /* kill process if it becomes invalid */
2293 CS_CHECK_EXPIRATION = 0x00000400, /* force expiration checking */
2294 CS_RESTRICT = 0x00000800, /* tell dyld to treat restricted */
2295
2296 CS_ENFORCEMENT = 0x00001000, /* require enforcement */
2297 CS_REQUIRE_LV = 0x00002000, /* require library validation */
2299 0x00004000, /* code signature permits restricted entitlements */
2301 0x00008000, /* has com.apple.rootless.restricted-nvram-variables.heritable
2302 entitlement */
2303
2304 CS_RUNTIME = 0x00010000, /* Apply hardened runtime policies */
2305 CS_LINKER_SIGNED = 0x00020000, /* Automatically signed by the linker */
2306
2310
2311 CS_EXEC_SET_HARD = 0x00100000, /* set CS_HARD on any exec'ed process */
2312 CS_EXEC_SET_KILL = 0x00200000, /* set CS_KILL on any exec'ed process */
2314 0x00400000, /* set CS_ENFORCEMENT on any exec'ed process */
2316 0x00800000, /* set CS_INSTALLER on any exec'ed process */
2317
2318 CS_KILLED = 0x01000000, /* was killed by kernel for invalidity */
2320 0x02000000, /* dyld used to load this is a platform binary */
2321 CS_PLATFORM_BINARY = 0x04000000, /* this is a platform binary */
2323 0x08000000, /* platform binary by the fact of path (osx only) */
2324
2325 CS_DEBUGGED = 0x10000000, /* process is currently or has previously been
2326 debugged and allowed to run with invalid pages */
2327 CS_SIGNED = 0x20000000, /* process has a signature (may have gone invalid) */
2329 0x40000000, /* code is dev signed, cannot be loaded into prod signed code
2330 (will go away with rdar://problem/28322552) */
2332 0x80000000, /* has Data Vault controller entitlement */
2333
2336};
2337
2338/* executable segment flags */
2339
2341
2342 CS_EXECSEG_MAIN_BINARY = 0x1, /* executable segment denotes main binary */
2343 CS_EXECSEG_ALLOW_UNSIGNED = 0x10, /* allow unsigned pages (for debugging) */
2344 CS_EXECSEG_DEBUGGER = 0x20, /* main binary is debugger */
2345 CS_EXECSEG_JIT = 0x40, /* JIT enabled */
2346 CS_EXECSEG_SKIP_LV = 0x80, /* OBSOLETE: skip library validation */
2347 CS_EXECSEG_CAN_LOAD_CDHASH = 0x100, /* can bless cdhash for execution */
2348 CS_EXECSEG_CAN_EXEC_CDHASH = 0x200, /* can execute blessed cdhash */
2349
2350};
2351
2352/* Magic numbers used by Code Signing */
2353
2355 CSMAGIC_REQUIREMENT = 0xfade0c00, /* single Requirement blob */
2357 0xfade0c01, /* Requirements vector (internal requirements) */
2358 CSMAGIC_CODEDIRECTORY = 0xfade0c02, /* CodeDirectory blob */
2359 CSMAGIC_EMBEDDED_SIGNATURE = 0xfade0cc0, /* embedded form of signature data */
2360 CSMAGIC_EMBEDDED_SIGNATURE_OLD = 0xfade0b02, /* XXX */
2361 CSMAGIC_EMBEDDED_ENTITLEMENTS = 0xfade7171, /* embedded entitlements */
2363 0xfade0cc1, /* multi-arch collection of embedded signatures */
2364 CSMAGIC_BLOBWRAPPER = 0xfade0b01, /* CMS Signature, among other things */
2365
2372
2373 CSSLOT_CODEDIRECTORY = 0, /* slot index for CodeDirectory */
2379
2381 0x1000, /* first alternate CodeDirectory, if any */
2382 CSSLOT_ALTERNATE_CODEDIRECTORY_MAX = 5, /* max number of alternate CD slots */
2385 CSSLOT_ALTERNATE_CODEDIRECTORY_MAX, /* one past the last */
2386
2387 CSSLOT_SIGNATURESLOT = 0x10000, /* CMS Signature */
2390
2391 CSTYPE_INDEX_REQUIREMENTS = 0x00000002, /* compat with amfi */
2392 CSTYPE_INDEX_ENTITLEMENTS = 0x00000005, /* compat with amfi */
2393
2398
2402
2403 CS_CDHASH_LEN = 20, /* always - larger hashes are truncated */
2404 CS_HASH_MAX_SIZE = 48, /* max size of the hash we'll support */
2405
2406 /*
2407 * Currently only to support Legacy VPN plugins, and Mac App Store
2408 * but intended to replace all the various platform code, dev code etc. bits.
2409 */
2413
2417};
2418
2420 uint32_t magic; /* magic number (CSMAGIC_CODEDIRECTORY) */
2421 uint32_t length; /* total length of CodeDirectory blob */
2422 uint32_t version; /* compatibility version */
2423 uint32_t flags; /* setup and mode flags */
2424 uint32_t hashOffset; /* offset of hash slot element at index zero */
2425 uint32_t identOffset; /* offset of identifier string */
2426 uint32_t nSpecialSlots; /* number of special hash slots */
2427 uint32_t nCodeSlots; /* number of ordinary (code) hash slots */
2428 uint32_t codeLimit; /* limit to main image signature range */
2429 uint8_t hashSize; /* size of each hash in bytes */
2430 uint8_t hashType; /* type of hash (cdHashType* constants) */
2431 uint8_t platform; /* platform identifier; zero if not platform binary */
2432 uint8_t pageSize; /* log2(page size in bytes); 0 => infinite */
2433 uint32_t spare2; /* unused (must be zero) */
2434
2435 /* Version 0x20100 */
2436 uint32_t scatterOffset; /* offset of optional scatter vector */
2437
2438 /* Version 0x20200 */
2439 uint32_t teamOffset; /* offset of optional team identifier */
2440
2441 /* Version 0x20300 */
2442 uint32_t spare3; /* unused (must be zero) */
2443 uint64_t codeLimit64; /* limit to main image signature range, 64 bits */
2444
2445 /* Version 0x20400 */
2446 uint64_t execSegBase; /* offset of executable segment */
2447 uint64_t execSegLimit; /* limit of executable segment */
2448 uint64_t execSegFlags; /* executable segment flags */
2449};
2450
2451static_assert(sizeof(CS_CodeDirectory) == 88);
2452
2454 uint32_t type; /* type of entry */
2455 uint32_t offset; /* offset of entry */
2456};
2457
2459 uint32_t magic; /* magic number */
2460 uint32_t length; /* total length of SuperBlob */
2461 uint32_t count; /* number of index entries following */
2462 /* followed by Blobs in no particular order as indicated by index offsets */
2463};
2464
2466 kSecCodeSignatureNoHash = 0, /* null value */
2470 3, /* SHA-256 truncated to first 20 bytes */
2473};
2474
2485
2486} // end namespace MachO
2487} // end namespace llvm
2488
2489#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
#define LLVM_PACKED_END
Definition Compiler.h:555
#define LLVM_PACKED_START
Definition Compiler.h:554
lazy value info
#define H(x, y, z)
Definition MD5.cpp:56
#define T
Tagged union holding either a T or a Error.
Definition Error.h:485
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
const uint32_t x86_FLOAT_STATE_COUNT
Definition MachO.h:2040
@ SG_READ_ONLY
Definition MachO.h:110
@ SG_FVMLIB
Definition MachO.h:107
@ SG_PROTECTED_VERSION_1
Definition MachO.h:109
@ SG_HIGHVM
Definition MachO.h:106
@ SECTION_ATTRIBUTES
Definition MachO.h:115
@ SG_NORELOC
Definition MachO.h:108
@ SECTION_ATTRIBUTES_USR
Definition MachO.h:116
@ SECTION_ATTRIBUTES_SYS
Definition MachO.h:117
@ SECTION_TYPE
Definition MachO.h:114
ChainedImportFormat
Definition MachO.h:1083
@ DYLD_CHAINED_IMPORT
Definition MachO.h:1084
@ DYLD_CHAINED_IMPORT_ADDEND
Definition MachO.h:1085
@ DYLD_CHAINED_IMPORT_ADDEND64
Definition MachO.h:1086
@ VM_PROT_EXECUTE
Definition MachO.h:554
@ VM_PROT_READ
Definition MachO.h:554
@ VM_PROT_WRITE
Definition MachO.h:554
const uint32_t ARM_THREAD_STATE64_COUNT
Definition MachO.h:2118
@ N_VERSION
Definition MachO.h:381
ExportSymbolKind
Definition MachO.h:298
@ EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE
Definition MachO.h:301
@ EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL
Definition MachO.h:300
@ EXPORT_SYMBOL_FLAGS_KIND_REGULAR
Definition MachO.h:299
@ BIND_TYPE_TEXT_PCREL32
Definition MachO.h:257
@ BIND_TYPE_POINTER
Definition MachO.h:255
@ BIND_TYPE_TEXT_ABSOLUTE32
Definition MachO.h:256
CodeSignExecSegFlags
Definition MachO.h:2340
@ CS_EXECSEG_ALLOW_UNSIGNED
Definition MachO.h:2343
@ CS_EXECSEG_MAIN_BINARY
Definition MachO.h:2342
@ CS_EXECSEG_DEBUGGER
Definition MachO.h:2344
@ CS_EXECSEG_CAN_LOAD_CDHASH
Definition MachO.h:2347
@ CS_EXECSEG_JIT
Definition MachO.h:2345
@ CS_EXECSEG_SKIP_LV
Definition MachO.h:2346
@ CS_EXECSEG_CAN_EXEC_CDHASH
Definition MachO.h:2348
const uint32_t x86_EXCEPTION_STATE_COUNT
Definition MachO.h:2042
@ ARM_EXCEPTION_STATE64
Definition MachO.h:2106
@ ARN_THREAD_STATE_NONE
Definition MachO.h:2104
@ ARM_THREAD_STATE64
Definition MachO.h:2105
@ ARM_VFP_STATE
Definition MachO.h:2101
@ ARM_DEBUG_STATE
Definition MachO.h:2103
@ ARM_THREAD_STATE
Definition MachO.h:2100
@ ARM_EXCEPTION_STATE
Definition MachO.h:2102
@ EXPORT_SYMBOL_FLAGS_REEXPORT
Definition MachO.h:294
@ EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION
Definition MachO.h:293
@ EXPORT_SYMBOL_FLAGS_KIND_MASK
Definition MachO.h:292
@ EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER
Definition MachO.h:295
@ CPU_SUBTYPE_SPARC_ALL
Definition MachO.h:1739
@ REBASE_TYPE_POINTER
Definition MachO.h:235
@ REBASE_TYPE_TEXT_ABSOLUTE32
Definition MachO.h:236
@ REBASE_TYPE_TEXT_PCREL32
Definition MachO.h:237
x86_fp_control_precis
Definition MachO.h:1813
@ x86_FP_PREC_64B
Definition MachO.h:1816
@ x86_FP_PREC_53B
Definition MachO.h:1815
@ x86_FP_PREC_24B
Definition MachO.h:1814
int CPU_SUBTYPE_INTEL_MODEL(CPUSubTypeX86 ST)
Definition MachO.h:1680
bool isVirtualSection(uint8_t type)
Definition MachO.h:652
const uint32_t x86_FLOAT_STATE64_COUNT
Definition MachO.h:2033
LLVM_ABI Expected< uint32_t > getCPUSubType(const Triple &T)
Definition MachO.cpp:101
HeaderFileType
Definition MachO.h:40
@ MH_OBJECT
Definition MachO.h:43
@ MH_DYLINKER
Definition MachO.h:49
@ MH_CORE
Definition MachO.h:46
@ MH_PRELOAD
Definition MachO.h:47
@ MH_DSYM
Definition MachO.h:52
@ MH_DYLIB
Definition MachO.h:48
@ MH_DYLIB_STUB
Definition MachO.h:51
@ MH_KEXT_BUNDLE
Definition MachO.h:53
@ MH_FVMLIB
Definition MachO.h:45
@ MH_BUNDLE
Definition MachO.h:50
@ MH_FILESET
Definition MachO.h:54
@ MH_EXECUTE
Definition MachO.h:44
SectionType
These are the section type and attributes fields.
Definition MachO.h:122
@ S_THREAD_LOCAL_VARIABLE_POINTERS
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
Definition MachO.h:175
@ S_INTERPOSING
S_INTERPOSING - Section with only pairs of function pointers for interposing.
Definition MachO.h:158
@ S_GB_ZEROFILL
S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4 gigabytes).
Definition MachO.h:155
@ S_16BYTE_LITERALS
S_16BYTE_LITERALS - Section with only 16 byte literals.
Definition MachO.h:160
@ S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local variable initialization pointers to...
Definition MachO.h:178
@ S_COALESCED
S_COALESCED - Section contains symbols that are to be coalesced.
Definition MachO.h:152
@ S_THREAD_LOCAL_ZEROFILL
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
Definition MachO.h:169
@ S_LAZY_SYMBOL_POINTERS
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
Definition MachO.h:141
@ S_INIT_FUNC_OFFSETS
S_INIT_FUNC_OFFSETS - Section with 32-bit offsets to initializer functions.
Definition MachO.h:181
@ S_MOD_TERM_FUNC_POINTERS
S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for termination.
Definition MachO.h:150
@ S_MOD_INIT_FUNC_POINTERS
S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for initialization.
Definition MachO.h:147
@ S_CSTRING_LITERALS
S_CSTRING_LITERALS - Section with literal C strings.
Definition MachO.h:131
@ S_THREAD_LOCAL_REGULAR
S_THREAD_LOCAL_REGULAR - Thread local data section.
Definition MachO.h:167
@ S_DTRACE_DOF
S_DTRACE_DOF - Section contains DTrace Object Format.
Definition MachO.h:162
@ S_ZEROFILL
S_ZEROFILL - Zero fill on demand section.
Definition MachO.h:129
@ S_NON_LAZY_SYMBOL_POINTERS
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
Definition MachO.h:139
@ S_4BYTE_LITERALS
S_4BYTE_LITERALS - Section with 4 byte literals.
Definition MachO.h:133
@ LAST_KNOWN_SECTION_TYPE
Definition MachO.h:183
@ S_LITERAL_POINTERS
S_LITERAL_POINTERS - Section with pointers to literals.
Definition MachO.h:137
@ S_8BYTE_LITERALS
S_8BYTE_LITERALS - Section with 8 byte literals.
Definition MachO.h:135
@ S_LAZY_DYLIB_SYMBOL_POINTERS
S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to lazy loaded dylibs.
Definition MachO.h:165
@ S_THREAD_LOCAL_VARIABLES
S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure data.
Definition MachO.h:172
@ S_SYMBOL_STUBS
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
Definition MachO.h:144
@ S_REGULAR
S_REGULAR - Regular section.
Definition MachO.h:127
BindSpecialDylib
Definition MachO.h:260
@ BIND_SPECIAL_DYLIB_SELF
Definition MachO.h:261
@ BIND_SPECIAL_DYLIB_WEAK_LOOKUP
Definition MachO.h:264
@ BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE
Definition MachO.h:262
@ BIND_SPECIAL_DYLIB_FLAT_LOOKUP
Definition MachO.h:263
@ R_SCATTERED
Definition MachO.h:402
@ MH_DYLDLINK
Definition MachO.h:62
@ MH_APP_EXTENSION_SAFE
Definition MachO.h:85
@ MH_BINDS_TO_WEAK
Definition MachO.h:76
@ MH_PREBINDABLE
Definition MachO.h:71
@ MH_CANONICAL
Definition MachO.h:74
@ MH_PREBOUND
Definition MachO.h:64
@ MH_ROOT_SAFE
Definition MachO.h:78
@ MH_BINDATLOAD
Definition MachO.h:63
@ MH_NO_HEAP_EXECUTION
Definition MachO.h:84
@ MH_ALLMODSBOUND
Definition MachO.h:72
@ MH_LAZY_INIT
Definition MachO.h:66
@ MH_SIM_SUPPORT
Definition MachO.h:87
@ MH_ALLOW_STACK_EXECUTION
Definition MachO.h:77
@ MH_INCRLINK
Definition MachO.h:61
@ MH_SETUID_SAFE
Definition MachO.h:79
@ MH_FORCE_FLAT
Definition MachO.h:68
@ MH_WEAK_DEFINES
Definition MachO.h:75
@ MH_DEAD_STRIPPABLE_DYLIB
Definition MachO.h:82
@ MH_SPLIT_SEGS
Definition MachO.h:65
@ MH_NO_REEXPORTED_DYLIBS
Definition MachO.h:80
@ MH_HAS_TLV_DESCRIPTORS
Definition MachO.h:83
@ MH_TWOLEVEL
Definition MachO.h:67
@ MH_NOFIXPREBINDING
Definition MachO.h:70
@ MH_NOUNDEFS
Definition MachO.h:60
@ MH_DYLIB_IN_CACHE
Definition MachO.h:88
@ MH_NOMULTIDEFS
Definition MachO.h:69
@ MH_SUBSECTIONS_VIA_SYMBOLS
Definition MachO.h:73
@ MH_NLIST_OUTOFSYNC_WITH_DYLDINFO
Definition MachO.h:86
@ CSMAGIC_EMBEDDED_ENTITLEMENTS
Definition MachO.h:2361
@ CSSLOT_SIGNATURESLOT
Definition MachO.h:2387
@ CS_HASHTYPE_SHA256
Definition MachO.h:2395
@ CS_SIGNER_TYPE_UNKNOWN
Definition MachO.h:2410
@ CS_SIGNER_TYPE_LEGACYVPN
Definition MachO.h:2411
@ CSMAGIC_DETACHED_SIGNATURE
Definition MachO.h:2362
@ CS_SIGNER_TYPE_MAC_APP_STORE
Definition MachO.h:2412
@ CS_SUPPORTSRUNTIME
Definition MachO.h:2370
@ CSSLOT_REQUIREMENTS
Definition MachO.h:2375
@ CSTYPE_INDEX_ENTITLEMENTS
Definition MachO.h:2392
@ CSMAGIC_REQUIREMENT
Definition MachO.h:2355
@ CS_SUPPORTSLINKAGE
Definition MachO.h:2371
@ CSMAGIC_BLOBWRAPPER
Definition MachO.h:2364
@ CSSLOT_ENTITLEMENTS
Definition MachO.h:2378
@ CSMAGIC_EMBEDDED_SIGNATURE
Definition MachO.h:2359
@ CS_SUPPL_SIGNER_TYPE_TRUSTCACHE
Definition MachO.h:2415
@ CS_SHA256_LEN
Definition MachO.h:2400
@ CSSLOT_ALTERNATE_CODEDIRECTORIES
Definition MachO.h:2380
@ CSSLOT_IDENTIFICATIONSLOT
Definition MachO.h:2388
@ CS_HASHTYPE_SHA384
Definition MachO.h:2397
@ CSMAGIC_CODEDIRECTORY
Definition MachO.h:2358
@ CS_SHA256_TRUNCATED_LEN
Definition MachO.h:2401
@ CSSLOT_RESOURCEDIR
Definition MachO.h:2376
@ CSSLOT_APPLICATION
Definition MachO.h:2377
@ CS_SHA1_LEN
Definition MachO.h:2399
@ CSSLOT_TICKETSLOT
Definition MachO.h:2389
@ CSMAGIC_EMBEDDED_SIGNATURE_OLD
Definition MachO.h:2360
@ CS_HASHTYPE_SHA1
Definition MachO.h:2394
@ CSTYPE_INDEX_REQUIREMENTS
Definition MachO.h:2391
@ CSSLOT_ALTERNATE_CODEDIRECTORY_MAX
Definition MachO.h:2382
@ CS_SUPPORTSTEAMID
Definition MachO.h:2367
@ CS_SUPPL_SIGNER_TYPE_LOCAL
Definition MachO.h:2416
@ CS_HASHTYPE_SHA256_TRUNCATED
Definition MachO.h:2396
@ CS_SUPPORTSSCATTER
Definition MachO.h:2366
@ CSMAGIC_REQUIREMENTS
Definition MachO.h:2356
@ CSSLOT_INFOSLOT
Definition MachO.h:2374
@ CS_SUPPORTSCODELIMIT64
Definition MachO.h:2368
@ CSSLOT_ALTERNATE_CODEDIRECTORY_LIMIT
Definition MachO.h:2383
@ CSSLOT_CODEDIRECTORY
Definition MachO.h:2373
@ CS_HASH_MAX_SIZE
Definition MachO.h:2404
@ CS_SUPPL_SIGNER_TYPE_UNKNOWN
Definition MachO.h:2414
@ CS_SUPPORTSEXECSEG
Definition MachO.h:2369
@ CS_CDHASH_LEN
Definition MachO.h:2403
void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal)
Definition MachO.h:1598
int CPU_SUBTYPE_INTEL(int Family, int Model)
Definition MachO.h:1674
@ REBASE_IMMEDIATE_MASK
Definition MachO.h:240
@ REBASE_OPCODE_MASK
Definition MachO.h:240
SecCSDigestAlgorithm
Definition MachO.h:2465
@ kSecCodeSignatureHashSHA1
Definition MachO.h:2467
@ kSecCodeSignatureHashSHA256
Definition MachO.h:2468
@ kSecCodeSignatureHashSHA384
Definition MachO.h:2471
@ kSecCodeSignatureHashSHA256Truncated
Definition MachO.h:2469
@ kSecCodeSignatureNoHash
Definition MachO.h:2466
@ kSecCodeSignatureHashSHA512
Definition MachO.h:2472
@ DYLD_CHAINED_PTR_START_LAST
Definition MachO.h:1099
@ DYLD_CHAINED_PTR_START_NONE
Definition MachO.h:1097
@ DYLD_CHAINED_PTR_START_MULTI
Definition MachO.h:1098
uint8_t GET_COMM_ALIGN(uint16_t n_desc)
Definition MachO.h:1602
void swapStruct(fat_header &mh)
Definition MachO.h:1197
@ LC_REQ_DYLD
Definition MachO.h:93
const uint32_t x86_THREAD_STATE32_COUNT
Definition MachO.h:2028
@ BIND_SYMBOL_FLAGS_WEAK_IMPORT
Definition MachO.h:268
@ BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION
Definition MachO.h:269
@ BIND_OPCODE_MASK
Definition MachO.h:271
@ BIND_IMMEDIATE_MASK
Definition MachO.h:272
@ REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY
Definition MachO.h:339
@ REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY
Definition MachO.h:340
@ DYNAMIC_LOOKUP_ORDINAL
Definition MachO.h:354
@ N_COLD_FUNC
Definition MachO.h:349
@ REFERENCE_FLAG_UNDEFINED_LAZY
Definition MachO.h:336
@ N_WEAK_DEF
Definition MachO.h:346
@ EXECUTABLE_ORDINAL
Definition MachO.h:355
@ REFERENCE_FLAG_UNDEFINED_NON_LAZY
Definition MachO.h:335
@ REFERENCED_DYNAMICALLY
Definition MachO.h:343
@ REFERENCE_FLAG_DEFINED
Definition MachO.h:337
@ N_ARM_THUMB_DEF
Definition MachO.h:342
@ MAX_LIBRARY_ORDINAL
Definition MachO.h:353
@ SELF_LIBRARY_ORDINAL
Definition MachO.h:352
@ N_NO_DEAD_STRIP
Definition MachO.h:344
@ REFERENCE_TYPE
Definition MachO.h:334
@ N_SYMBOL_RESOLVER
Definition MachO.h:347
@ REFERENCE_FLAG_PRIVATE_DEFINED
Definition MachO.h:338
@ N_ALT_ENTRY
Definition MachO.h:348
@ N_WEAK_REF
Definition MachO.h:345
@ PPC_THREAD_STATE
Definition MachO.h:2225
@ PPC_EXCEPTION_STATE
Definition MachO.h:2227
@ PPC_VECTOR_STATE
Definition MachO.h:2228
@ PPC_EXCEPTION_STATE64
Definition MachO.h:2230
@ PPC_THREAD_STATE64
Definition MachO.h:2229
@ PPC_FLOAT_STATE
Definition MachO.h:2226
@ PPC_THREAD_STATE_NONE
Definition MachO.h:2231
bool CPU_SUBTYPE_ARM64E_IS_KERNEL_PTRAUTH_ABI(uint32_t ST)
Definition MachO.h:1733
@ DYLD_CHAINED_SYMBOL_ZLIB
Definition MachO.h:1092
@ DYLD_CHAINED_SYMBOL_UNCOMPRESSED
Definition MachO.h:1091
CPUSubTypePowerPC
Definition MachO.h:1741
@ CPU_SUBTYPE_POWERPC_970
Definition MachO.h:1754
@ CPU_SUBTYPE_POWERPC_604e
Definition MachO.h:1749
@ CPU_SUBTYPE_MC98601
Definition MachO.h:1757
@ CPU_SUBTYPE_POWERPC_603e
Definition MachO.h:1746
@ CPU_SUBTYPE_POWERPC_7400
Definition MachO.h:1752
@ CPU_SUBTYPE_POWERPC_604
Definition MachO.h:1748
@ CPU_SUBTYPE_MC980000_ALL
Definition MachO.h:1756
@ CPU_SUBTYPE_POWERPC_750
Definition MachO.h:1751
@ CPU_SUBTYPE_POWERPC_601
Definition MachO.h:1743
@ CPU_SUBTYPE_POWERPC_620
Definition MachO.h:1750
@ CPU_SUBTYPE_POWERPC_603ev
Definition MachO.h:1747
@ CPU_SUBTYPE_POWERPC_ALL
Definition MachO.h:1742
@ CPU_SUBTYPE_POWERPC_603
Definition MachO.h:1745
@ CPU_SUBTYPE_POWERPC_7450
Definition MachO.h:1753
@ CPU_SUBTYPE_POWERPC_602
Definition MachO.h:1744
@ BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB
Definition MachO.h:288
@ BIND_OPCODE_DONE
Definition MachO.h:276
@ BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB
Definition MachO.h:286
@ BIND_OPCODE_SET_ADDEND_SLEB
Definition MachO.h:282
@ BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB
Definition MachO.h:278
@ BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
Definition MachO.h:280
@ BIND_OPCODE_ADD_ADDR_ULEB
Definition MachO.h:284
@ BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED
Definition MachO.h:287
@ BIND_OPCODE_SET_DYLIB_SPECIAL_IMM
Definition MachO.h:279
@ BIND_OPCODE_DO_BIND
Definition MachO.h:285
@ BIND_OPCODE_SET_TYPE_IMM
Definition MachO.h:281
@ BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
Definition MachO.h:277
@ BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
Definition MachO.h:283
@ DYLD_CHAINED_PTR_32
Definition MachO.h:1106
@ DYLD_CHAINED_PTR_ARM64E_USERLAND
Definition MachO.h:1112
@ DYLD_CHAINED_PTR_ARM64E_USERLAND24
Definition MachO.h:1115
@ DYLD_CHAINED_PTR_64_KERNEL_CACHE
Definition MachO.h:1111
@ DYLD_CHAINED_PTR_32_CACHE
Definition MachO.h:1107
@ DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE
Definition MachO.h:1114
@ DYLD_CHAINED_PTR_64_OFFSET
Definition MachO.h:1109
@ DYLD_CHAINED_PTR_ARM64E_FIRMWARE
Definition MachO.h:1113
@ DYLD_CHAINED_PTR_ARM64E_KERNEL
Definition MachO.h:1110
@ DYLD_CHAINED_PTR_32_FIRMWARE
Definition MachO.h:1108
@ DYLD_CHAINED_PTR_64
Definition MachO.h:1105
@ DYLD_CHAINED_PTR_ARM64E
Definition MachO.h:1104
@ x86_FLOAT_STATE32
Definition MachO.h:1997
@ x86_DEBUG_STATE
Definition MachO.h:2007
@ x86_THREAD_STATE
Definition MachO.h:2002
@ x86_THREAD_STATE64
Definition MachO.h:1999
@ x86_EXCEPTION_STATE64
Definition MachO.h:2001
@ x86_FLOAT_STATE64
Definition MachO.h:2000
@ x86_EXCEPTION_STATE
Definition MachO.h:2004
@ x86_THREAD_STATE32
Definition MachO.h:1996
@ x86_FLOAT_STATE
Definition MachO.h:2003
@ x86_DEBUG_STATE64
Definition MachO.h:2006
@ x86_DEBUG_STATE32
Definition MachO.h:2005
@ x86_EXCEPTION_STATE32
Definition MachO.h:1998
@ TOOL_SWIFT
Definition MachO.h:565
@ TOOL_CLANG
Definition MachO.h:565
const uint32_t PPC_THREAD_STATE_COUNT
Definition MachO.h:2240
@ MH_MAGIC
Definition MachO.h:30
@ MH_CIGAM_64
Definition MachO.h:33
@ FAT_CIGAM_64
Definition MachO.h:37
@ MH_CIGAM
Definition MachO.h:31
@ FAT_CIGAM
Definition MachO.h:35
@ FAT_MAGIC_64
Definition MachO.h:36
@ FAT_MAGIC
Definition MachO.h:34
@ MH_MAGIC_64
Definition MachO.h:32
unsigned CPU_SUBTYPE_ARM64E_PTRAUTH_VERSION(uint32_t ST)
Definition MachO.h:1713
const uint32_t ARM_THREAD_STATE_COUNT
Definition MachO.h:2115
@ REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
Definition MachO.h:245
@ REBASE_OPCODE_DO_REBASE_IMM_TIMES
Definition MachO.h:248
@ REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
Definition MachO.h:250
@ REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
Definition MachO.h:251
@ REBASE_OPCODE_DO_REBASE_ULEB_TIMES
Definition MachO.h:249
@ REBASE_OPCODE_ADD_ADDR_ULEB
Definition MachO.h:246
@ REBASE_OPCODE_SET_TYPE_IMM
Definition MachO.h:244
@ REBASE_OPCODE_DONE
Definition MachO.h:243
@ REBASE_OPCODE_ADD_ADDR_IMM_SCALED
Definition MachO.h:247
@ CPU_ARCH_ABI64
Definition MachO.h:1614
@ CPU_ARCH_ABI64_32
Definition MachO.h:1615
@ CPU_ARCH_MASK
Definition MachO.h:1613
@ CPU_SUBTYPE_RISCV_ALL
Definition MachO.h:1761
bool CPU_SUBTYPE_ARM64E_IS_VERSIONED_PTRAUTH_ABI(uint32_t ST)
Definition MachO.h:1729
int CPU_SUBTYPE_INTEL_FAMILY(CPUSubTypeX86 ST)
Definition MachO.h:1677
LinkerOptimizationHintKind
Definition MachO.h:2475
@ LOH_ARM64_ADRP_LDR_GOT_LDR
Definition MachO.h:2479
@ LOH_ARM64_ADRP_ADRP
Definition MachO.h:2476
@ LOH_ARM64_ADRP_LDR_GOT_STR
Definition MachO.h:2481
@ LOH_ARM64_ADRP_ADD_LDR
Definition MachO.h:2478
@ LOH_ARM64_ADRP_ADD
Definition MachO.h:2482
@ LOH_ARM64_ADRP_LDR
Definition MachO.h:2477
@ LOH_ARM64_ADRP_ADD_STR
Definition MachO.h:2480
@ LOH_ARM64_ADRP_LDR_GOT
Definition MachO.h:2483
void SET_COMM_ALIGN(uint16_t &n_desc, uint8_t align)
Definition MachO.h:1606
@ CPU_SUBTYPE_ARM_V7
Definition MachO.h:1690
@ CPU_SUBTYPE_ARM_V5TEJ
Definition MachO.h:1688
@ CPU_SUBTYPE_ARM_ALL
Definition MachO.h:1684
@ CPU_SUBTYPE_ARM_V7M
Definition MachO.h:1695
@ CPU_SUBTYPE_ARM_V6
Definition MachO.h:1686
@ CPU_SUBTYPE_ARM_XSCALE
Definition MachO.h:1689
@ CPU_SUBTYPE_ARM_V7K
Definition MachO.h:1693
@ CPU_SUBTYPE_ARM_V6M
Definition MachO.h:1694
@ CPU_SUBTYPE_ARM_V5
Definition MachO.h:1687
@ CPU_SUBTYPE_ARM_V7EM
Definition MachO.h:1696
@ CPU_SUBTYPE_ARM_V7S
Definition MachO.h:1692
@ CPU_SUBTYPE_ARM_V4T
Definition MachO.h:1685
@ CPU_SUBTYPE_ARM64E
Definition MachO.h:1702
@ CPU_SUBTYPE_ARM64E_VERSIONED_PTRAUTH_ABI_MASK
Definition MachO.h:1706
@ CPU_SUBTYPE_ARM64E_KERNEL_PTRAUTH_ABI_MASK
Definition MachO.h:1708
@ CPU_SUBTYPE_ARM64_ALL
Definition MachO.h:1700
@ CPU_SUBTYPE_ARM64E_PTRAUTH_MASK
Definition MachO.h:1710
@ CPU_SUBTYPE_ARM64_V8
Definition MachO.h:1701
const uint32_t x86_THREAD_STATE_COUNT
Definition MachO.h:2038
CPUSubTypeARM64_32
Definition MachO.h:1737
@ CPU_SUBTYPE_ARM64_32_V8
Definition MachO.h:1737
@ CS_ENTITLEMENT_FLAGS
Definition MachO.h:2334
@ CS_CHECK_EXPIRATION
Definition MachO.h:2293
@ CS_INSTALLER
Definition MachO.h:2284
@ CS_REQUIRE_LV
Definition MachO.h:2297
@ CS_LINKER_SIGNED
Definition MachO.h:2305
@ CS_GET_TASK_ALLOW
Definition MachO.h:2283
@ CS_DEBUGGED
Definition MachO.h:2325
@ CS_PLATFORM_BINARY
Definition MachO.h:2321
@ CS_DYLD_PLATFORM
Definition MachO.h:2319
@ CS_ENFORCEMENT
Definition MachO.h:2296
@ CS_INVALID_ALLOWED
Definition MachO.h:2288
@ CS_DATAVAULT_CONTROLLER
Definition MachO.h:2331
@ CS_FORCED_LV
Definition MachO.h:2286
@ CS_DEV_CODE
Definition MachO.h:2328
@ CS_EXEC_SET_ENFORCEMENT
Definition MachO.h:2313
@ CS_EXEC_SET_HARD
Definition MachO.h:2311
@ CS_RESTRICT
Definition MachO.h:2294
@ CS_EXEC_SET_KILL
Definition MachO.h:2312
@ CS_PLATFORM_PATH
Definition MachO.h:2322
@ CS_EXEC_INHERIT_SIP
Definition MachO.h:2315
@ CS_NVRAM_UNRESTRICTED
Definition MachO.h:2300
@ CS_ENTITLEMENTS_VALIDATED
Definition MachO.h:2298
@ CS_ALLOWED_MACHO
Definition MachO.h:2307
@ DICE_KIND_JUMP_TABLE8
Definition MachO.h:228
@ DICE_KIND_ABS_JUMP_TABLE32
Definition MachO.h:231
@ DICE_KIND_JUMP_TABLE16
Definition MachO.h:229
@ DICE_KIND_JUMP_TABLE32
Definition MachO.h:230
@ DICE_KIND_DATA
Definition MachO.h:227
RelocationInfoType
Definition MachO.h:405
@ X86_64_RELOC_UNSIGNED
Definition MachO.h:540
@ X86_64_RELOC_SIGNED
Definition MachO.h:541
@ X86_64_RELOC_GOT
Definition MachO.h:544
@ ARM_RELOC_PAIR
Definition MachO.h:441
@ GENERIC_RELOC_LOCAL_SECTDIFF
Definition MachO.h:414
@ ARM_RELOC_BR24
Definition MachO.h:445
@ PPC_RELOC_PAIR
Definition MachO.h:421
@ RISCV_RELOC_GOT_HI20
Definition MachO.h:522
@ ARM_THUMB_RELOC_BR22
Definition MachO.h:446
@ PPC_RELOC_SECTDIFF
Definition MachO.h:428
@ PPC_RELOC_HI16
Definition MachO.h:424
@ PPC_RELOC_PB_LA_PTR
Definition MachO.h:429
@ ARM_RELOC_PB_LA_PTR
Definition MachO.h:444
@ ARM64_RELOC_PAGEOFF12
Definition MachO.h:464
@ PPC_RELOC_HA16_SECTDIFF
Definition MachO.h:432
@ ARM_RELOC_LOCAL_SECTDIFF
Definition MachO.h:443
@ ARM64_RELOC_POINTER_TO_GOT
Definition MachO.h:470
@ RISCV_RELOC_HI20
Definition MachO.h:505
@ X86_64_RELOC_GOT_LOAD
Definition MachO.h:543
@ RISCV_RELOC_POINTER_TO_GOT
Definition MachO.h:529
@ ARM64_RELOC_AUTHENTICATED_POINTER
Definition MachO.h:478
@ GENERIC_RELOC_PB_LA_PTR
Definition MachO.h:413
@ X86_64_RELOC_BRANCH
Definition MachO.h:542
@ X86_64_RELOC_SIGNED_2
Definition MachO.h:547
@ RISCV_RELOC_GOT_LO12
Definition MachO.h:525
@ GENERIC_RELOC_PAIR
Definition MachO.h:411
@ RISCV_RELOC_BRANCH21
Definition MachO.h:502
@ GENERIC_RELOC_VANILLA
Definition MachO.h:410
@ X86_64_RELOC_TLV
Definition MachO.h:549
@ ARM64_RELOC_SUBTRACTOR
Definition MachO.h:458
@ PPC_RELOC_LOCAL_SECTDIFF
Definition MachO.h:435
@ ARM_THUMB_32BIT_BRANCH
Definition MachO.h:447
@ ARM_RELOC_HALF_SECTDIFF
Definition MachO.h:449
@ PPC_RELOC_JBSR
Definition MachO.h:433
@ RISCV_RELOC_UNSIGNED
Definition MachO.h:483
@ PPC_RELOC_LO14_SECTDIFF
Definition MachO.h:434
@ RISCV_RELOC_SUBTRACTOR
Definition MachO.h:496
@ GENERIC_RELOC_TLV
Definition MachO.h:415
@ PPC_RELOC_LO16_SECTDIFF
Definition MachO.h:431
@ ARM64_RELOC_ADDEND
Definition MachO.h:476
@ ARM64_RELOC_UNSIGNED
Definition MachO.h:456
@ ARM_RELOC_SECTDIFF
Definition MachO.h:442
@ PPC_RELOC_BR24
Definition MachO.h:423
@ PPC_RELOC_LO16
Definition MachO.h:425
@ ARM64_RELOC_GOT_LOAD_PAGE21
Definition MachO.h:466
@ X86_64_RELOC_SIGNED_4
Definition MachO.h:548
@ GENERIC_RELOC_INVALID
Definition MachO.h:409
@ PPC_RELOC_HA16
Definition MachO.h:426
@ RISCV_RELOC_LO12
Definition MachO.h:516
@ GENERIC_RELOC_SECTDIFF
Definition MachO.h:412
@ X86_64_RELOC_SUBTRACTOR
Definition MachO.h:545
@ ARM64_RELOC_TLVP_LOAD_PAGEOFF12
Definition MachO.h:474
@ RISCV_RELOC_ADDEND
Definition MachO.h:535
@ PPC_RELOC_BR14
Definition MachO.h:422
@ X86_64_RELOC_SIGNED_1
Definition MachO.h:546
@ ARM64_RELOC_PAGE21
Definition MachO.h:462
@ PPC_RELOC_VANILLA
Definition MachO.h:420
@ PPC_RELOC_HI16_SECTDIFF
Definition MachO.h:430
@ ARM64_RELOC_GOT_LOAD_PAGEOFF12
Definition MachO.h:468
@ PPC_RELOC_LO14
Definition MachO.h:427
@ ARM_RELOC_HALF
Definition MachO.h:448
@ ARM64_RELOC_TLVP_LOAD_PAGE21
Definition MachO.h:472
@ ARM_RELOC_VANILLA
Definition MachO.h:440
@ ARM64_RELOC_BRANCH26
Definition MachO.h:460
x86_fp_control_rc
Definition MachO.h:1819
@ x86_FP_RND_UP
Definition MachO.h:1822
@ x86_FP_RND_DOWN
Definition MachO.h:1821
@ x86_FP_RND_NEAR
Definition MachO.h:1820
@ x86_FP_CHOP
Definition MachO.h:1823
uint32_t CPU_SUBTYPE_ARM64E_WITH_PTRAUTH_VERSION(unsigned PtrAuthABIVersion, bool PtrAuthKernelABIVersion)
Definition MachO.h:1718
uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc)
Definition MachO.h:1594
@ CPU_SUBTYPE_INTEL_FAMILY_MAX
Definition MachO.h:1681
@ CPU_SUBTYPE_INTEL_MODEL_ALL
Definition MachO.h:1681
LoadCommandType
Definition MachO.h:98
LLVM_ABI Expected< uint32_t > getCPUType(const Triple &T)
Definition MachO.cpp:81
@ S_ATTR_SOME_INSTRUCTIONS
S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
Definition MachO.h:213
@ S_ATTR_EXT_RELOC
S_ATTR_EXT_RELOC - Section has external relocation entries.
Definition MachO.h:215
@ S_ATTR_DEBUG
S_ATTR_DEBUG - A debug section.
Definition MachO.h:207
@ S_ATTR_NO_DEAD_STRIP
S_ATTR_NO_DEAD_STRIP - No dead stripping.
Definition MachO.h:200
@ S_ATTR_LOC_RELOC
S_ATTR_LOC_RELOC - Section has local relocation entries.
Definition MachO.h:217
@ S_ATTR_NO_TOC
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents.
Definition MachO.h:195
@ S_ATTR_LIVE_SUPPORT
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
Definition MachO.h:202
@ S_ATTR_PURE_INSTRUCTIONS
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
Definition MachO.h:192
@ S_ATTR_SELF_MODIFYING_CODE
S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by dyld.
Definition MachO.h:205
@ S_ATTR_STRIP_STATIC_SYMS
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
Definition MachO.h:198
@ INDIRECT_SYMBOL_ABS
Definition MachO.h:222
@ INDIRECT_SYMBOL_LOCAL
Definition MachO.h:221
const uint32_t x86_EXCEPTION_STATE64_COUNT
Definition MachO.h:2035
@ CPU_SUBTYPE_386
Definition MachO.h:1648
@ CPU_SUBTYPE_586
Definition MachO.h:1651
@ CPU_SUBTYPE_X86_ALL
Definition MachO.h:1669
@ CPU_SUBTYPE_CELERON_MOBILE
Definition MachO.h:1657
@ CPU_SUBTYPE_PENTII_M3
Definition MachO.h:1654
@ CPU_SUBTYPE_I386_ALL
Definition MachO.h:1647
@ CPU_SUBTYPE_X86_ARCH1
Definition MachO.h:1671
@ CPU_SUBTYPE_PENTIUM_3_XEON
Definition MachO.h:1660
@ CPU_SUBTYPE_ITANIUM_2
Definition MachO.h:1665
@ CPU_SUBTYPE_PENTII_M5
Definition MachO.h:1655
@ CPU_SUBTYPE_X86_64_H
Definition MachO.h:1672
@ CPU_SUBTYPE_PENTIUM_M
Definition MachO.h:1661
@ CPU_SUBTYPE_PENTIUM_3_M
Definition MachO.h:1659
@ CPU_SUBTYPE_PENTPRO
Definition MachO.h:1653
@ CPU_SUBTYPE_486SX
Definition MachO.h:1650
@ CPU_SUBTYPE_X86_64_ALL
Definition MachO.h:1670
@ CPU_SUBTYPE_CELERON
Definition MachO.h:1656
@ CPU_SUBTYPE_ITANIUM
Definition MachO.h:1664
@ CPU_SUBTYPE_PENTIUM_4_M
Definition MachO.h:1663
@ CPU_SUBTYPE_PENT
Definition MachO.h:1652
@ CPU_SUBTYPE_486
Definition MachO.h:1649
@ CPU_SUBTYPE_PENTIUM_3
Definition MachO.h:1658
@ CPU_SUBTYPE_PENTIUM_4
Definition MachO.h:1662
@ CPU_SUBTYPE_XEON
Definition MachO.h:1666
@ CPU_SUBTYPE_XEON_MP
Definition MachO.h:1667
const uint32_t x86_THREAD_STATE64_COUNT
Definition MachO.h:2031
@ CPU_SUBTYPE_LIB64
Definition MachO.h:1639
@ CPU_SUBTYPE_MULTIPLE
Definition MachO.h:1642
@ CPU_SUBTYPE_MASK
Definition MachO.h:1638
@ CPU_TYPE_ARM64_32
Definition MachO.h:1628
@ CPU_TYPE_ARM64
Definition MachO.h:1627
@ CPU_TYPE_ANY
Definition MachO.h:1620
@ CPU_TYPE_POWERPC
Definition MachO.h:1630
@ CPU_TYPE_X86_64
Definition MachO.h:1623
@ CPU_TYPE_POWERPC64
Definition MachO.h:1631
@ CPU_TYPE_X86
Definition MachO.h:1621
@ CPU_TYPE_RISCV
Definition MachO.h:1633
@ CPU_TYPE_SPARC
Definition MachO.h:1629
@ CPU_TYPE_I386
Definition MachO.h:1622
@ CPU_TYPE_MC98000
Definition MachO.h:1625
@ CPU_TYPE_ARM
Definition MachO.h:1626
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
arm_thread_state32_t ts32
Definition MachO.h:2090
union llvm::MachO::arm_thread_state_t::@303126343162322332223050011263367006216164356124 uts
Definition MachO.h:865
uint16_t length
Definition MachO.h:867
uint16_t kind
Definition MachO.h:868
uint32_t offset
Definition MachO.h:866
Structs for dyld chained fixups.
Definition MachO.h:1121
uint32_t imports_count
Number of imported symbol names.
Definition MachO.h:1126
uint32_t imports_format
DYLD_CHAINED_IMPORT*.
Definition MachO.h:1127
uint32_t imports_offset
Offset of imports table in chain_data.
Definition MachO.h:1124
uint32_t starts_offset
Offset of dyld_chained_starts_in_image.
Definition MachO.h:1123
uint32_t symbols_offset
Offset of symbol strings in chain_data.
Definition MachO.h:1125
uint32_t symbols_format
0 => uncompressed, 1 => zlib compressed
Definition MachO.h:1128
dyld_chained_starts_in_image is embedded in LC_DYLD_CHAINED_FIXUPS payload.
Definition MachO.h:1134
uint16_t page_count
Length of the page_start array.
Definition MachO.h:1145
uint16_t page_size
Page size in bytes (0x1000 or 0x4000)
Definition MachO.h:1141
uint16_t pointer_format
DYLD_CHAINED_PTR*.
Definition MachO.h:1142
uint32_t max_valid_pointer
Values beyond this are not pointers on 32-bit.
Definition MachO.h:1144
uint64_t segment_offset
VM offset from the __TEXT segment.
Definition MachO.h:1143
uint32_t size
Size of this, including chain_starts entries.
Definition MachO.h:1140
uint16_t page_start[1]
Page offset of first fixup on each page, or DYLD_CHAINED_PTR_START_NONE if no fixups.
Definition MachO.h:1146
uint32_t objc_module_info_size
Definition MachO.h:803
uint32_t objc_module_info_addr
Definition MachO.h:802
uint32_t current_version
Definition MachO.h:673
uint32_t name
Definition MachO.h:671
uint32_t compatibility_version
Definition MachO.h:674
uint32_t timestamp
Definition MachO.h:672
uint32_t cpusubtype
Definition MachO.h:1020
Definition MachO.h:956
uint64_t vmaddr
Definition MachO.h:959
union lc_str entry_id
Definition MachO.h:961
uint32_t cmd
Definition MachO.h:957
uint32_t cmdsize
Definition MachO.h:958
uint64_t fileoff
Definition MachO.h:960
uint32_t reserved
Definition MachO.h:962
unsigned short denorm
Definition MachO.h:1827
unsigned short undfl
Definition MachO.h:1827
unsigned short ovrfl
Definition MachO.h:1827
unsigned short rc
Definition MachO.h:1828
unsigned short pc
Definition MachO.h:1828
unsigned short zdiv
Definition MachO.h:1827
unsigned short precis
Definition MachO.h:1828
unsigned short invalid
Definition MachO.h:1827
unsigned short c2
Definition MachO.h:1833
unsigned short errsumm
Definition MachO.h:1833
unsigned short precis
Definition MachO.h:1833
unsigned short invalid
Definition MachO.h:1832
unsigned short c1
Definition MachO.h:1833
unsigned short busy
Definition MachO.h:1834
unsigned short denorm
Definition MachO.h:1832
unsigned short c3
Definition MachO.h:1834
unsigned short zdiv
Definition MachO.h:1832
unsigned short c0
Definition MachO.h:1833
unsigned short stkflt
Definition MachO.h:1833
unsigned short tos
Definition MachO.h:1833
unsigned short undfl
Definition MachO.h:1832
unsigned short ovrfl
Definition MachO.h:1832
struct fvmlib fvmlib
Definition MachO.h:667
uint32_t header_addr
Definition MachO.h:660
uint32_t name
Definition MachO.h:658
uint32_t minor_version
Definition MachO.h:659
uint32_t n_strx
Definition MachO.h:1067
uint32_t n_value
Definition MachO.h:1071
ppc_thread_state32_t ts32
Definition MachO.h:2215
union llvm::MachO::ppc_thread_state_t::@135077343136105332156230151222221222221032170010 uts
uint32_t reserved2
Definition MachO.h:634
uint32_t reloff
Definition MachO.h:630
char sectname[16]
Definition MachO.h:624
uint32_t reserved1
Definition MachO.h:633
char segname[16]
Definition MachO.h:625
uint32_t offset
Definition MachO.h:628
uint32_t nreloc
Definition MachO.h:631
union llvm::MachO::x86_exception_state_t::@050043077327255314063252313156247224257021205374 ues
x86_exception_state64_t es64
Definition MachO.h:1986
x86_float_state64_t fs64
Definition MachO.h:1979
union llvm::MachO::x86_float_state_t::@252203374302256000206214376342322154037210364120 ufs
x86_thread_state64_t ts64
Definition MachO.h:1971
x86_thread_state32_t ts32
Definition MachO.h:1972
union llvm::MachO::x86_thread_state_t::@001173320355100273222071151033237015104146215062 uts
uint32_t offset
Definition MachO.h:953