Lines Matching refs:MachO
79 MachO::swapStruct(Cmd); in getStruct()
92 MachO::swapStruct(Cmd); in getStructOrErr()
102 unsigned SegmentLoadSize = Is64 ? sizeof(MachO::segment_command_64) : in getSectionPtr()
103 sizeof(MachO::segment_command); in getSectionPtr()
104 unsigned SectionSize = Is64 ? sizeof(MachO::section_64) : in getSectionPtr()
105 sizeof(MachO::section); in getSectionPtr()
118 static MachO::nlist_base
121 return getStruct<MachO::nlist_base>(O, P); in getSymbolTableEntryBase()
141 getPlainRelocationAddress(const MachO::any_relocation_info &RE) { in getPlainRelocationAddress()
146 getScatteredRelocationAddress(const MachO::any_relocation_info &RE) { in getScatteredRelocationAddress()
151 const MachO::any_relocation_info &RE) { in getPlainRelocationPCRel()
158 getScatteredRelocationPCRel(const MachO::any_relocation_info &RE) { in getScatteredRelocationPCRel()
163 const MachO::any_relocation_info &RE) { in getPlainRelocationLength()
170 getScatteredRelocationLength(const MachO::any_relocation_info &RE) { in getScatteredRelocationLength()
175 const MachO::any_relocation_info &RE) { in getPlainRelocationType()
184 MachO::section_64 Sect = O.getSection64(Sec); in getSectionFlags()
187 MachO::section Sect = O.getSection(Sec); in getSectionFlags()
194 if (auto CmdOrErr = getStructOrErr<MachO::load_command>(Obj, Ptr)) { in getLoadCommandInfo()
208 unsigned HeaderSize = Obj.is64Bit() ? sizeof(MachO::mach_header_64) in getFirstLoadCommandInfo()
209 : sizeof(MachO::mach_header); in getFirstLoadCommandInfo()
210 if (sizeof(MachO::load_command) > Obj.getHeader().sizeofcmds) in getFirstLoadCommandInfo()
220 unsigned HeaderSize = Obj.is64Bit() ? sizeof(MachO::mach_header_64) in getNextLoadCommandInfo()
221 : sizeof(MachO::mach_header); in getNextLoadCommandInfo()
222 if (L.Ptr + L.C.cmdsize + sizeof(MachO::load_command) > in getNextLoadCommandInfo()
310 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
311 Obj.getHeader().filetype != MachO::MH_DSYM && in parseSegmentLoadCommand()
312 s.flags != MachO::S_ZEROFILL && in parseSegmentLoadCommand()
313 s.flags != MachO::S_THREAD_LOCAL_ZEROFILL && in parseSegmentLoadCommand()
318 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
319 Obj.getHeader().filetype != MachO::MH_DSYM && in parseSegmentLoadCommand()
320 s.flags != MachO::S_ZEROFILL && in parseSegmentLoadCommand()
321 s.flags != MachO::S_THREAD_LOCAL_ZEROFILL && S.fileoff == 0 && in parseSegmentLoadCommand()
328 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
329 Obj.getHeader().filetype != MachO::MH_DSYM && in parseSegmentLoadCommand()
330 s.flags != MachO::S_ZEROFILL && in parseSegmentLoadCommand()
331 s.flags != MachO::S_THREAD_LOCAL_ZEROFILL && in parseSegmentLoadCommand()
337 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
338 Obj.getHeader().filetype != MachO::MH_DSYM && in parseSegmentLoadCommand()
339 s.flags != MachO::S_ZEROFILL && in parseSegmentLoadCommand()
340 s.flags != MachO::S_THREAD_LOCAL_ZEROFILL && in parseSegmentLoadCommand()
346 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
347 Obj.getHeader().filetype != MachO::MH_DSYM && s.size != 0 && in parseSegmentLoadCommand()
362 if (Obj.getHeader().filetype != MachO::MH_DYLIB_STUB && in parseSegmentLoadCommand()
363 Obj.getHeader().filetype != MachO::MH_DSYM && in parseSegmentLoadCommand()
364 s.flags != MachO::S_ZEROFILL && in parseSegmentLoadCommand()
365 s.flags != MachO::S_THREAD_LOCAL_ZEROFILL) in parseSegmentLoadCommand()
374 BigSize *= sizeof(struct MachO::relocation_info); in parseSegmentLoadCommand()
384 MachO::relocation_info), in parseSegmentLoadCommand()
414 if (Load.C.cmdsize < sizeof(MachO::symtab_command)) in checkSymtabCommand()
419 auto SymtabOrErr = getStructOrErr<MachO::symtab_command>(Obj, Load.Ptr); in checkSymtabCommand()
422 MachO::symtab_command Symtab = SymtabOrErr.get(); in checkSymtabCommand()
423 if (Symtab.cmdsize != sizeof(MachO::symtab_command)) in checkSymtabCommand()
434 SymtabSize *= sizeof(MachO::nlist_64); in checkSymtabCommand()
437 SymtabSize *= sizeof(MachO::nlist); in checkSymtabCommand()
472 if (Load.C.cmdsize < sizeof(MachO::dysymtab_command)) in checkDysymtabCommand()
478 getStructOrErr<MachO::dysymtab_command>(Obj, Load.Ptr); in checkDysymtabCommand()
481 MachO::dysymtab_command Dysymtab = DysymtabOrErr.get(); in checkDysymtabCommand()
482 if (Dysymtab.cmdsize != sizeof(MachO::dysymtab_command)) in checkDysymtabCommand()
491 BigSize *= sizeof(MachO::dylib_table_of_contents); in checkDysymtabCommand()
500 MachO::dylib_table_of_contents), in checkDysymtabCommand()
511 sizeof_modtab = sizeof(MachO::dylib_module_64); in checkDysymtabCommand()
514 sizeof_modtab = sizeof(MachO::dylib_module); in checkDysymtabCommand()
533 BigSize *= sizeof(MachO::dylib_reference); in checkDysymtabCommand()
542 sizeof(MachO::dylib_reference), in checkDysymtabCommand()
567 BigSize *= sizeof(MachO::relocation_info); in checkDysymtabCommand()
576 sizeof(MachO::relocation_info), in checkDysymtabCommand()
584 BigSize *= sizeof(MachO::relocation_info); in checkDysymtabCommand()
593 sizeof(MachO::relocation_info), in checkDysymtabCommand()
606 if (Load.C.cmdsize < sizeof(MachO::linkedit_data_command)) in checkLinkeditDataCommand()
612 getStructOrErr<MachO::linkedit_data_command>(Obj, Load.Ptr); in checkLinkeditDataCommand()
615 MachO::linkedit_data_command LinkData = LinkDataOrError.get(); in checkLinkeditDataCommand()
616 if (LinkData.cmdsize != sizeof(MachO::linkedit_data_command)) in checkLinkeditDataCommand()
643 if (Load.C.cmdsize < sizeof(MachO::dyld_info_command)) in checkDyldInfoCommand()
650 getStructOrErr<MachO::dyld_info_command>(Obj, Load.Ptr); in checkDyldInfoCommand()
653 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in checkDyldInfoCommand()
654 if (DyldInfo.cmdsize != sizeof(MachO::dyld_info_command)) in checkDyldInfoCommand()
740 if (Load.C.cmdsize < sizeof(MachO::dylib_command)) in checkDylibCommand()
743 auto CommandOrErr = getStructOrErr<MachO::dylib_command>(Obj, Load.Ptr); in checkDylibCommand()
746 MachO::dylib_command D = CommandOrErr.get(); in checkDylibCommand()
747 if (D.dylib.name < sizeof(MachO::dylib_command)) in checkDylibCommand()
778 if (Obj.getHeader().filetype != MachO::MH_DYLIB && in checkDylibIdCommand()
779 Obj.getHeader().filetype != MachO::MH_DYLIB_STUB) in checkDylibIdCommand()
789 if (Load.C.cmdsize < sizeof(MachO::dylinker_command)) in checkDyldCommand()
792 auto CommandOrErr = getStructOrErr<MachO::dylinker_command>(Obj, Load.Ptr); in checkDyldCommand()
795 MachO::dylinker_command D = CommandOrErr.get(); in checkDyldCommand()
796 if (D.name < sizeof(MachO::dylinker_command)) in checkDyldCommand()
822 if (Load.C.cmdsize != sizeof(MachO::version_min_command)) in checkVersCommand()
837 if (Load.C.cmdsize != sizeof(MachO::note_command)) in checkNoteCommand()
840 auto NoteCmdOrErr = getStructOrErr<MachO::note_command>(Obj, Load.Ptr); in checkNoteCommand()
843 MachO::note_command Nt = NoteCmdOrErr.get(); in checkNoteCommand()
867 getStructOrErr<MachO::build_version_command>(Obj, Load.Ptr); in parseBuildVersionCommand()
870 MachO::build_version_command BVC = BVCOrErr.get(); in parseBuildVersionCommand()
872 sizeof(MachO::build_version_command) + in parseBuildVersionCommand()
873 BVC.ntools * sizeof(MachO::build_tool_version)) in parseBuildVersionCommand()
877 auto Start = Load.Ptr + sizeof(MachO::build_version_command); in parseBuildVersionCommand()
880 BuildTools[i] = Start + i * sizeof(MachO::build_tool_version); in parseBuildVersionCommand()
888 if (Load.C.cmdsize < sizeof(MachO::rpath_command)) in checkRpathCommand()
891 auto ROrErr = getStructOrErr<MachO::rpath_command>(Obj, Load.Ptr); in checkRpathCommand()
894 MachO::rpath_command R = ROrErr.get(); in checkRpathCommand()
895 if (R.path < sizeof(MachO::rpath_command)) in checkRpathCommand()
944 if (Load.C.cmdsize < sizeof(MachO::linker_option_command)) in checkLinkerOptCommand()
948 getStructOrErr<MachO::linker_option_command>(Obj, Load.Ptr); in checkLinkerOptCommand()
951 MachO::linker_option_command L = LinkOptionOrErr.get(); in checkLinkerOptCommand()
954 sizeof(struct MachO::linker_option_command); in checkLinkerOptCommand()
955 uint32_t left = L.cmdsize - sizeof(struct MachO::linker_option_command); in checkLinkerOptCommand()
1012 if (Load.C.cmdsize < sizeof(MachO::thread_command)) in checkThreadCommand()
1016 getStructOrErr<MachO::thread_command>(Obj, Load.Ptr); in checkThreadCommand()
1019 MachO::thread_command T = ThreadCommandOrErr.get(); in checkThreadCommand()
1020 const char *state = Load.Ptr + sizeof(MachO::thread_command); in checkThreadCommand()
1045 if (cputype == MachO::CPU_TYPE_I386) { in checkThreadCommand()
1046 if (flavor == MachO::x86_THREAD_STATE32) { in checkThreadCommand()
1047 if (count != MachO::x86_THREAD_STATE32_COUNT) in checkThreadCommand()
1053 if (state + sizeof(MachO::x86_thread_state32_t) > end) in checkThreadCommand()
1057 state += sizeof(MachO::x86_thread_state32_t); in checkThreadCommand()
1064 } else if (cputype == MachO::CPU_TYPE_X86_64) { in checkThreadCommand()
1065 if (flavor == MachO::x86_THREAD_STATE) { in checkThreadCommand()
1066 if (count != MachO::x86_THREAD_STATE_COUNT) in checkThreadCommand()
1072 if (state + sizeof(MachO::x86_thread_state_t) > end) in checkThreadCommand()
1076 state += sizeof(MachO::x86_thread_state_t); in checkThreadCommand()
1077 } else if (flavor == MachO::x86_FLOAT_STATE) { in checkThreadCommand()
1078 if (count != MachO::x86_FLOAT_STATE_COUNT) in checkThreadCommand()
1084 if (state + sizeof(MachO::x86_float_state_t) > end) in checkThreadCommand()
1088 state += sizeof(MachO::x86_float_state_t); in checkThreadCommand()
1089 } else if (flavor == MachO::x86_EXCEPTION_STATE) { in checkThreadCommand()
1090 if (count != MachO::x86_EXCEPTION_STATE_COUNT) in checkThreadCommand()
1096 if (state + sizeof(MachO::x86_exception_state_t) > end) in checkThreadCommand()
1100 state += sizeof(MachO::x86_exception_state_t); in checkThreadCommand()
1101 } else if (flavor == MachO::x86_THREAD_STATE64) { in checkThreadCommand()
1102 if (count != MachO::x86_THREAD_STATE64_COUNT) in checkThreadCommand()
1108 if (state + sizeof(MachO::x86_thread_state64_t) > end) in checkThreadCommand()
1112 state += sizeof(MachO::x86_thread_state64_t); in checkThreadCommand()
1113 } else if (flavor == MachO::x86_EXCEPTION_STATE64) { in checkThreadCommand()
1114 if (count != MachO::x86_EXCEPTION_STATE64_COUNT) in checkThreadCommand()
1120 if (state + sizeof(MachO::x86_exception_state64_t) > end) in checkThreadCommand()
1124 state += sizeof(MachO::x86_exception_state64_t); in checkThreadCommand()
1131 } else if (cputype == MachO::CPU_TYPE_ARM) { in checkThreadCommand()
1132 if (flavor == MachO::ARM_THREAD_STATE) { in checkThreadCommand()
1133 if (count != MachO::ARM_THREAD_STATE_COUNT) in checkThreadCommand()
1139 if (state + sizeof(MachO::arm_thread_state32_t) > end) in checkThreadCommand()
1143 state += sizeof(MachO::arm_thread_state32_t); in checkThreadCommand()
1150 } else if (cputype == MachO::CPU_TYPE_ARM64 || in checkThreadCommand()
1151 cputype == MachO::CPU_TYPE_ARM64_32) { in checkThreadCommand()
1152 if (flavor == MachO::ARM_THREAD_STATE64) { in checkThreadCommand()
1153 if (count != MachO::ARM_THREAD_STATE64_COUNT) in checkThreadCommand()
1159 if (state + sizeof(MachO::arm_thread_state64_t) > end) in checkThreadCommand()
1163 state += sizeof(MachO::arm_thread_state64_t); in checkThreadCommand()
1170 } else if (cputype == MachO::CPU_TYPE_POWERPC) { in checkThreadCommand()
1171 if (flavor == MachO::PPC_THREAD_STATE) { in checkThreadCommand()
1172 if (count != MachO::PPC_THREAD_STATE_COUNT) in checkThreadCommand()
1178 if (state + sizeof(MachO::ppc_thread_state32_t) > end) in checkThreadCommand()
1182 state += sizeof(MachO::ppc_thread_state32_t); in checkThreadCommand()
1205 if (Load.C.cmdsize != sizeof(MachO::twolevel_hints_command)) in checkTwoLevelHintsCommand()
1210 auto HintsOrErr = getStructOrErr<MachO::twolevel_hints_command>(Obj, Load.Ptr); in checkTwoLevelHintsCommand()
1213 MachO::twolevel_hints_command Hints = HintsOrErr.get(); in checkTwoLevelHintsCommand()
1220 BigSize *= sizeof(MachO::twolevel_hint); in checkTwoLevelHintsCommand()
1228 sizeof(MachO::twolevel_hint), in checkTwoLevelHintsCommand()
1239 if (cmd == MachO::LC_SYMSEG || in isLoadCommandObsolete()
1240 cmd == MachO::LC_LOADFVMLIB || in isLoadCommandObsolete()
1241 cmd == MachO::LC_IDFVMLIB || in isLoadCommandObsolete()
1242 cmd == MachO::LC_IDENT || in isLoadCommandObsolete()
1243 cmd == MachO::LC_FVMFILE || in isLoadCommandObsolete()
1244 cmd == MachO::LC_PREPAGE || in isLoadCommandObsolete()
1245 cmd == MachO::LC_PREBOUND_DYLIB || in isLoadCommandObsolete()
1246 cmd == MachO::LC_TWOLEVEL_HINTS || in isLoadCommandObsolete()
1247 cmd == MachO::LC_PREBIND_CKSUM) in isLoadCommandObsolete()
1278 SizeOfHeaders = sizeof(MachO::mach_header_64); in MachOObjectFile()
1282 SizeOfHeaders = sizeof(MachO::mach_header); in MachOObjectFile()
1329 if (getHeader().filetype != MachO::MH_CORE || in MachOObjectFile()
1330 Load.C.cmd != MachO::LC_THREAD || Load.C.cmdsize % 4) { in MachOObjectFile()
1344 if (Load.C.cmd == MachO::LC_SYMTAB) { in MachOObjectFile()
1347 } else if (Load.C.cmd == MachO::LC_DYSYMTAB) { in MachOObjectFile()
1351 } else if (Load.C.cmd == MachO::LC_DATA_IN_CODE) { in MachOObjectFile()
1356 } else if (Load.C.cmd == MachO::LC_LINKER_OPTIMIZATION_HINT) { in MachOObjectFile()
1362 } else if (Load.C.cmd == MachO::LC_FUNCTION_STARTS) { in MachOObjectFile()
1367 } else if (Load.C.cmd == MachO::LC_SEGMENT_SPLIT_INFO) { in MachOObjectFile()
1372 } else if (Load.C.cmd == MachO::LC_DYLIB_CODE_SIGN_DRS) { in MachOObjectFile()
1377 } else if (Load.C.cmd == MachO::LC_CODE_SIGNATURE) { in MachOObjectFile()
1382 } else if (Load.C.cmd == MachO::LC_DYLD_INFO) { in MachOObjectFile()
1386 } else if (Load.C.cmd == MachO::LC_DYLD_INFO_ONLY) { in MachOObjectFile()
1390 } else if (Load.C.cmd == MachO::LC_DYLD_CHAINED_FIXUPS) { in MachOObjectFile()
1395 } else if (Load.C.cmd == MachO::LC_DYLD_EXPORTS_TRIE) { in MachOObjectFile()
1400 } else if (Load.C.cmd == MachO::LC_UUID) { in MachOObjectFile()
1401 if (Load.C.cmdsize != sizeof(MachO::uuid_command)) { in MachOObjectFile()
1411 } else if (Load.C.cmd == MachO::LC_SEGMENT_64) { in MachOObjectFile()
1412 if ((Err = parseSegmentLoadCommand<MachO::segment_command_64, in MachOObjectFile()
1413 MachO::section_64>( in MachOObjectFile()
1417 } else if (Load.C.cmd == MachO::LC_SEGMENT) { in MachOObjectFile()
1418 if ((Err = parseSegmentLoadCommand<MachO::segment_command, in MachOObjectFile()
1419 MachO::section>( in MachOObjectFile()
1423 } else if (Load.C.cmd == MachO::LC_ID_DYLIB) { in MachOObjectFile()
1426 } else if (Load.C.cmd == MachO::LC_LOAD_DYLIB) { in MachOObjectFile()
1430 } else if (Load.C.cmd == MachO::LC_LOAD_WEAK_DYLIB) { in MachOObjectFile()
1434 } else if (Load.C.cmd == MachO::LC_LAZY_LOAD_DYLIB) { in MachOObjectFile()
1438 } else if (Load.C.cmd == MachO::LC_REEXPORT_DYLIB) { in MachOObjectFile()
1442 } else if (Load.C.cmd == MachO::LC_LOAD_UPWARD_DYLIB) { in MachOObjectFile()
1446 } else if (Load.C.cmd == MachO::LC_ID_DYLINKER) { in MachOObjectFile()
1449 } else if (Load.C.cmd == MachO::LC_LOAD_DYLINKER) { in MachOObjectFile()
1452 } else if (Load.C.cmd == MachO::LC_DYLD_ENVIRONMENT) { in MachOObjectFile()
1455 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_MACOSX) { in MachOObjectFile()
1459 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_IPHONEOS) { in MachOObjectFile()
1463 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_TVOS) { in MachOObjectFile()
1467 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_WATCHOS) { in MachOObjectFile()
1471 } else if (Load.C.cmd == MachO::LC_NOTE) { in MachOObjectFile()
1474 } else if (Load.C.cmd == MachO::LC_BUILD_VERSION) { in MachOObjectFile()
1477 } else if (Load.C.cmd == MachO::LC_RPATH) { in MachOObjectFile()
1480 } else if (Load.C.cmd == MachO::LC_SOURCE_VERSION) { in MachOObjectFile()
1481 if (Load.C.cmdsize != sizeof(MachO::source_version_command)) { in MachOObjectFile()
1491 } else if (Load.C.cmd == MachO::LC_MAIN) { in MachOObjectFile()
1492 if (Load.C.cmdsize != sizeof(MachO::entry_point_command)) { in MachOObjectFile()
1502 } else if (Load.C.cmd == MachO::LC_ENCRYPTION_INFO) { in MachOObjectFile()
1503 if (Load.C.cmdsize != sizeof(MachO::encryption_info_command)) { in MachOObjectFile()
1508 MachO::encryption_info_command E = in MachOObjectFile()
1509 getStruct<MachO::encryption_info_command>(*this, Load.Ptr); in MachOObjectFile()
1513 } else if (Load.C.cmd == MachO::LC_ENCRYPTION_INFO_64) { in MachOObjectFile()
1514 if (Load.C.cmdsize != sizeof(MachO::encryption_info_command_64)) { in MachOObjectFile()
1519 MachO::encryption_info_command_64 E = in MachOObjectFile()
1520 getStruct<MachO::encryption_info_command_64>(*this, Load.Ptr); in MachOObjectFile()
1524 } else if (Load.C.cmd == MachO::LC_LINKER_OPTION) { in MachOObjectFile()
1527 } else if (Load.C.cmd == MachO::LC_SUB_FRAMEWORK) { in MachOObjectFile()
1528 if (Load.C.cmdsize < sizeof(MachO::sub_framework_command)) { in MachOObjectFile()
1533 MachO::sub_framework_command S = in MachOObjectFile()
1534 getStruct<MachO::sub_framework_command>(*this, Load.Ptr); in MachOObjectFile()
1536 sizeof(MachO::sub_framework_command), in MachOObjectFile()
1540 } else if (Load.C.cmd == MachO::LC_SUB_UMBRELLA) { in MachOObjectFile()
1541 if (Load.C.cmdsize < sizeof(MachO::sub_umbrella_command)) { in MachOObjectFile()
1546 MachO::sub_umbrella_command S = in MachOObjectFile()
1547 getStruct<MachO::sub_umbrella_command>(*this, Load.Ptr); in MachOObjectFile()
1549 sizeof(MachO::sub_umbrella_command), in MachOObjectFile()
1553 } else if (Load.C.cmd == MachO::LC_SUB_LIBRARY) { in MachOObjectFile()
1554 if (Load.C.cmdsize < sizeof(MachO::sub_library_command)) { in MachOObjectFile()
1559 MachO::sub_library_command S = in MachOObjectFile()
1560 getStruct<MachO::sub_library_command>(*this, Load.Ptr); in MachOObjectFile()
1562 sizeof(MachO::sub_library_command), in MachOObjectFile()
1566 } else if (Load.C.cmd == MachO::LC_SUB_CLIENT) { in MachOObjectFile()
1567 if (Load.C.cmdsize < sizeof(MachO::sub_client_command)) { in MachOObjectFile()
1572 MachO::sub_client_command S = in MachOObjectFile()
1573 getStruct<MachO::sub_client_command>(*this, Load.Ptr); in MachOObjectFile()
1575 sizeof(MachO::sub_client_command), in MachOObjectFile()
1578 } else if (Load.C.cmd == MachO::LC_ROUTINES) { in MachOObjectFile()
1579 if (Load.C.cmdsize != sizeof(MachO::routines_command)) { in MachOObjectFile()
1590 } else if (Load.C.cmd == MachO::LC_ROUTINES_64) { in MachOObjectFile()
1591 if (Load.C.cmdsize != sizeof(MachO::routines_command_64)) { in MachOObjectFile()
1602 } else if (Load.C.cmd == MachO::LC_UNIXTHREAD) { in MachOObjectFile()
1610 } else if (Load.C.cmd == MachO::LC_THREAD) { in MachOObjectFile()
1614 } else if (Load.C.cmd == MachO::LC_TWOLEVEL_HINTS) { in MachOObjectFile()
1618 } else if (Load.C.cmd == MachO::LC_IDENT) { in MachOObjectFile()
1646 MachO::symtab_command Symtab = in MachOObjectFile()
1647 getStruct<MachO::symtab_command>(*this, SymtabLoadCmd); in MachOObjectFile()
1648 MachO::dysymtab_command Dysymtab = in MachOObjectFile()
1649 getStruct<MachO::dysymtab_command>(*this, DysymtabLoadCmd); in MachOObjectFile()
1688 if ((getHeader().filetype == MachO::MH_DYLIB || in MachOObjectFile()
1689 getHeader().filetype == MachO::MH_DYLIB_STUB) && in MachOObjectFile()
1703 MachO::mach_header_64 H_64 = MachOObjectFile::getHeader64(); in checkSymbolTable()
1706 MachO::mach_header H = MachOObjectFile::getHeader(); in checkSymbolTable()
1715 MachO::symtab_command S = getSymtabLoadCommand(); in checkSymbolTable()
1719 MachO::nlist_64 STE_64 = getSymbol64TableEntry(SymDRI); in checkSymbolTable()
1726 MachO::nlist STE = getSymbolTableEntry(SymDRI); in checkSymbolTable()
1733 if ((NType & MachO::N_STAB) == 0) { in checkSymbolTable()
1734 if ((NType & MachO::N_TYPE) == MachO::N_SECT) { in checkSymbolTable()
1739 if ((NType & MachO::N_TYPE) == MachO::N_INDR) { in checkSymbolTable()
1745 if ((Flags & MachO::MH_TWOLEVEL) == MachO::MH_TWOLEVEL && in checkSymbolTable()
1746 (((NType & MachO::N_TYPE) == MachO::N_UNDF && NValue == 0) || in checkSymbolTable()
1747 (NType & MachO::N_TYPE) == MachO::N_PBUD)) { in checkSymbolTable()
1748 uint32_t LibraryOrdinal = MachO::GET_LIBRARY_ORDINAL(NDesc); in checkSymbolTable()
1750 LibraryOrdinal != MachO::EXECUTABLE_ORDINAL && in checkSymbolTable()
1751 LibraryOrdinal != MachO::DYNAMIC_LOOKUP_ORDINAL && in checkSymbolTable()
1769 sizeof(MachO::nlist_64) : in moveSymbolNext()
1770 sizeof(MachO::nlist); in moveSymbolNext()
1776 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, Symb); in getSymbolName()
1792 return Flags & MachO::SECTION_TYPE; in getSectionType()
1797 MachO::nlist_64 Entry = getSymbol64TableEntry(Sym); in getNValue()
1800 MachO::nlist Entry = getSymbolTableEntry(Sym); in getNValue()
1809 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, Symb); in getIndirectName()
1810 if ((Entry.n_type & MachO::N_TYPE) != MachO::N_INDR) in getIndirectName()
1831 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, DRI); in getSymbolAlignment()
1832 return 1 << MachO::GET_COMM_ALIGN(Entry.n_desc); in getSymbolAlignment()
1843 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, Symb); in getSymbolType()
1847 if (n_type & MachO::N_STAB) in getSymbolType()
1850 switch (n_type & MachO::N_TYPE) { in getSymbolType()
1851 case MachO::N_UNDF : in getSymbolType()
1853 case MachO::N_SECT : in getSymbolType()
1868 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, DRI); in getSymbolFlags()
1875 if ((MachOType & MachO::N_TYPE) == MachO::N_INDR) in getSymbolFlags()
1878 if (MachOType & MachO::N_STAB) in getSymbolFlags()
1881 if (MachOType & MachO::N_EXT) { in getSymbolFlags()
1883 if ((MachOType & MachO::N_TYPE) == MachO::N_UNDF) { in getSymbolFlags()
1890 if (MachOType & MachO::N_PEXT) in getSymbolFlags()
1895 } else if (MachOType & MachO::N_PEXT) in getSymbolFlags()
1898 if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF)) in getSymbolFlags()
1901 if (MachOFlags & (MachO::N_ARM_THUMB_DEF)) in getSymbolFlags()
1904 if ((MachOType & MachO::N_TYPE) == MachO::N_ABS) in getSymbolFlags()
1912 MachO::nlist_base Entry = getSymbolTableEntryBase(*this, Symb); in getSymbolSection()
1927 MachO::nlist_base Entry = in getSymbolSectionID()
1960 MachO::section_64 Sect = getSection64(Sec); in getSectionSize()
1963 SectType = Sect.flags & MachO::SECTION_TYPE; in getSectionSize()
1965 MachO::section Sect = getSection(Sec); in getSectionSize()
1968 SectType = Sect.flags & MachO::SECTION_TYPE; in getSectionSize()
1970 if (SectType == MachO::S_ZEROFILL || SectType == MachO::S_GB_ZEROFILL) in getSectionSize()
1991 MachO::section_64 Sect = getSection64(Sec); in getSectionContents()
1995 MachO::section Sect = getSection(Sec); in getSectionContents()
2006 MachO::section_64 Sect = getSection64(Sec); in getSectionAlignment()
2009 MachO::section Sect = getSection(Sec); in getSectionAlignment()
2042 return Flags & MachO::S_ATTR_PURE_INSTRUCTIONS; in isSectionText()
2047 unsigned SectionType = Flags & MachO::SECTION_TYPE; in isSectionData()
2048 return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && in isSectionData()
2049 !(SectionType == MachO::S_ZEROFILL || in isSectionData()
2050 SectionType == MachO::S_GB_ZEROFILL); in isSectionData()
2055 unsigned SectionType = Flags & MachO::SECTION_TYPE; in isSectionBSS()
2056 return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && in isSectionBSS()
2057 (SectionType == MachO::S_ZEROFILL || in isSectionBSS()
2058 SectionType == MachO::S_GB_ZEROFILL); in isSectionBSS()
2111 case MachO::LC_SEGMENT: in getSegmentContents()
2112 Contents = ::getSegmentContents<MachO::segment_command>(*this, LoadCmd, in getSegmentContents()
2115 case MachO::LC_SEGMENT_64: in getSegmentContents()
2116 Contents = ::getSegmentContents<MachO::segment_command_64>(*this, LoadCmd, in getSegmentContents()
2133 case MachO::LC_SEGMENT: in getSegmentContents()
2135 return ::getSegmentContents<MachO::segment_command>(*this, LoadCmd); in getSegmentContents()
2138 case MachO::LC_SEGMENT_64: in getSegmentContents()
2140 return ::getSegmentContents<MachO::segment_command_64>(*this, LoadCmd); in getSegmentContents()
2156 unsigned SectionType = Flags & MachO::SECTION_TYPE; in isSectionVirtual()
2157 return SectionType == MachO::S_ZEROFILL || in isSectionVirtual()
2158 SectionType == MachO::S_GB_ZEROFILL; in isSectionVirtual()
2185 MachO::section_64 Sect = getSection64(Sec); in section_rel_end()
2188 MachO::section Sect = getSection(Sec); in section_rel_end()
2207 MachO::dysymtab_command DysymtabLoadCmd = getDysymtabLoadCommand(); in extrel_end()
2224 MachO::dysymtab_command DysymtabLoadCmd = getDysymtabLoadCommand(); in locrel_end()
2237 assert((getHeader().filetype == MachO::MH_OBJECT || in getRelocationOffset()
2238 getHeader().filetype == MachO::MH_KEXT_BUNDLE) && in getRelocationOffset()
2240 MachO::any_relocation_info RE = getRelocation(Rel); in getRelocationOffset()
2246 MachO::any_relocation_info RE = getRelocation(Rel); in getRelocationSymbol()
2255 MachO::symtab_command S = getSymtabLoadCommand(); in getRelocationSymbol()
2257 sizeof(MachO::nlist_64) : in getRelocationSymbol()
2258 sizeof(MachO::nlist); in getRelocationSymbol()
2271 MachO::any_relocation_info RE = getRelocation(Rel); in getRelocationType()
2386 MachO::any_relocation_info RE = getRelocation(Rel); in getRelocationLength()
2562 getStructOrErr<MachO::dylib_command>(*this, Libraries[i]); in getLibraryShortNameByIndex()
2565 MachO::dylib_command D = CommandOrErr.get(); in getLibraryShortNameByIndex()
2599 MachO::symtab_command Symtab = getSymtabLoadCommand(); in symbol_begin()
2608 MachO::symtab_command Symtab = getSymtabLoadCommand(); in symbol_end()
2613 sizeof(MachO::nlist_64) : in symbol_end()
2614 sizeof(MachO::nlist); in symbol_end()
2622 MachO::symtab_command Symtab = getSymtabLoadCommand(); in getSymbolByIndex()
2626 is64Bit() ? sizeof(MachO::nlist_64) : sizeof(MachO::nlist); in getSymbolByIndex()
2634 MachO::symtab_command Symtab = getSymtabLoadCommand(); in getSymbolIndex()
2638 is64Bit() ? sizeof(MachO::nlist_64) : sizeof(MachO::nlist); in getSymbolIndex()
2664 case MachO::CPU_TYPE_I386: in getFileFormatName()
2666 case MachO::CPU_TYPE_ARM: in getFileFormatName()
2668 case MachO::CPU_TYPE_ARM64_32: in getFileFormatName()
2670 case MachO::CPU_TYPE_POWERPC: in getFileFormatName()
2678 case MachO::CPU_TYPE_X86_64: in getFileFormatName()
2680 case MachO::CPU_TYPE_ARM64: in getFileFormatName()
2682 case MachO::CPU_TYPE_POWERPC64: in getFileFormatName()
2691 case MachO::CPU_TYPE_I386: in getArch()
2693 case MachO::CPU_TYPE_X86_64: in getArch()
2695 case MachO::CPU_TYPE_ARM: in getArch()
2697 case MachO::CPU_TYPE_ARM64: in getArch()
2699 case MachO::CPU_TYPE_ARM64_32: in getArch()
2701 case MachO::CPU_TYPE_POWERPC: in getArch()
2703 case MachO::CPU_TYPE_POWERPC64: in getArch()
2719 case MachO::CPU_TYPE_I386: in getArchTriple()
2720 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2721 case MachO::CPU_SUBTYPE_I386_ALL: in getArchTriple()
2728 case MachO::CPU_TYPE_X86_64: in getArchTriple()
2729 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2730 case MachO::CPU_SUBTYPE_X86_64_ALL: in getArchTriple()
2734 case MachO::CPU_SUBTYPE_X86_64_H: in getArchTriple()
2741 case MachO::CPU_TYPE_ARM: in getArchTriple()
2742 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2743 case MachO::CPU_SUBTYPE_ARM_V4T: in getArchTriple()
2747 case MachO::CPU_SUBTYPE_ARM_V5TEJ: in getArchTriple()
2751 case MachO::CPU_SUBTYPE_ARM_XSCALE: in getArchTriple()
2755 case MachO::CPU_SUBTYPE_ARM_V6: in getArchTriple()
2759 case MachO::CPU_SUBTYPE_ARM_V6M: in getArchTriple()
2765 case MachO::CPU_SUBTYPE_ARM_V7: in getArchTriple()
2769 case MachO::CPU_SUBTYPE_ARM_V7EM: in getArchTriple()
2775 case MachO::CPU_SUBTYPE_ARM_V7K: in getArchTriple()
2781 case MachO::CPU_SUBTYPE_ARM_V7M: in getArchTriple()
2787 case MachO::CPU_SUBTYPE_ARM_V7S: in getArchTriple()
2796 case MachO::CPU_TYPE_ARM64: in getArchTriple()
2797 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2798 case MachO::CPU_SUBTYPE_ARM64_ALL: in getArchTriple()
2804 case MachO::CPU_SUBTYPE_ARM64E: in getArchTriple()
2813 case MachO::CPU_TYPE_ARM64_32: in getArchTriple()
2814 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2815 case MachO::CPU_SUBTYPE_ARM64_32_V8: in getArchTriple()
2824 case MachO::CPU_TYPE_POWERPC: in getArchTriple()
2825 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2826 case MachO::CPU_SUBTYPE_POWERPC_ALL: in getArchTriple()
2833 case MachO::CPU_TYPE_POWERPC64: in getArchTriple()
2834 switch (CPUSubType & ~MachO::CPU_SUBTYPE_MASK) { in getArchTriple()
2835 case MachO::CPU_SUBTYPE_POWERPC_ALL: in getArchTriple()
2906 MachO::linkedit_data_command DicLC = getDataInCodeLoadCommand(); in begin_dices()
2916 MachO::linkedit_data_command DicLC = getDataInCodeLoadCommand(); in end_dices()
3028 uint64_t Kind = State.Flags & MachO::EXPORT_SYMBOL_FLAGS_KIND_MASK; in pushNode()
3030 (Kind != MachO::EXPORT_SYMBOL_FLAGS_KIND_REGULAR && in pushNode()
3031 Kind != MachO::EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE && in pushNode()
3032 Kind != MachO::EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL)) { in pushNode()
3040 if (State.Flags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT) { in pushNode()
3096 if (State.Flags & MachO::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER) { in pushNode()
3257 if (Command.C.cmd == MachO::LC_SEGMENT) { in MachOAbstractFixupEntry()
3258 MachO::segment_command SLC = O->getSegmentLoadCommand(Command); in MachOAbstractFixupEntry()
3263 } else if (Command.C.cmd == MachO::LC_SEGMENT_64) { in MachOAbstractFixupEntry()
3264 MachO::segment_command_64 SLC_64 = O->getSegment64LoadCommand(Command); in MachOAbstractFixupEntry()
3345 SegInfo.PageStarts[PageIndex] == MachO::DYLD_CHAINED_PTR_START_NONE) in findNextPageWithFixups()
3394 if (PointerFormat != MachO::DYLD_CHAINED_PTR_64 && in moveNext()
3395 PointerFormat != MachO::DYLD_CHAINED_PTR_64_OFFSET) { in moveNext()
3417 static_assert(sizeof(RawValue) == sizeof(MachO::dyld_chained_import_addend)); in moveNext()
3450 Flags = Target.weakImport() ? MachO::BIND_SYMBOL_FLAGS_WEAK_IMPORT : 0; in moveNext()
3457 if (PointerFormat == MachO::DYLD_CHAINED_PTR_64_OFFSET) in moveNext()
3518 uint8_t ImmValue = Byte & MachO::REBASE_IMMEDIATE_MASK; in moveNext()
3519 uint8_t Opcode = Byte & MachO::REBASE_OPCODE_MASK; in moveNext()
3523 case MachO::REBASE_OPCODE_DONE: in moveNext()
3529 case MachO::REBASE_OPCODE_SET_TYPE_IMM: in moveNext()
3531 if (RebaseType > MachO::REBASE_TYPE_TEXT_PCREL32) { in moveNext()
3543 case MachO::REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: in moveNext()
3569 case MachO::REBASE_OPCODE_ADD_ADDR_ULEB: in moveNext()
3592 case MachO::REBASE_OPCODE_ADD_ADDR_IMM_SCALED: in moveNext()
3608 case MachO::REBASE_OPCODE_DO_REBASE_IMM_TIMES: in moveNext()
3633 case MachO::REBASE_OPCODE_DO_REBASE_ULEB_TIMES: in moveNext()
3665 case MachO::REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB: in moveNext()
3694 case MachO::REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB: in moveNext()
3762 case MachO::REBASE_TYPE_POINTER: in typeName()
3764 case MachO::REBASE_TYPE_TEXT_ABSOLUTE32: in typeName()
3766 case MachO::REBASE_TYPE_TEXT_PCREL32: in typeName()
3857 uint8_t ImmValue = Byte & MachO::BIND_IMMEDIATE_MASK; in moveNext()
3858 uint8_t Opcode = Byte & MachO::BIND_OPCODE_MASK; in moveNext()
3864 case MachO::BIND_OPCODE_DONE: in moveNext()
3881 case MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_IMM: in moveNext()
3906 case MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: in moveNext()
3938 case MachO::BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: in moveNext()
3947 SignExtended = MachO::BIND_OPCODE_MASK | ImmValue; in moveNext()
3949 if (Ordinal < MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP) { in moveNext()
3965 case MachO::BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: in moveNext()
3987 if (ImmValue & MachO::BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION) in moveNext()
3991 case MachO::BIND_OPCODE_SET_TYPE_IMM: in moveNext()
3993 if (ImmValue > MachO::BIND_TYPE_TEXT_PCREL32) { in moveNext()
4005 case MachO::BIND_OPCODE_SET_ADDEND_SLEB: in moveNext()
4019 case MachO::BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: in moveNext()
4045 case MachO::BIND_OPCODE_ADD_ADDR_ULEB: in moveNext()
4068 case MachO::BIND_OPCODE_DO_BIND: in moveNext()
4101 case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: in moveNext()
4165 case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: in moveNext()
4207 case MachO::BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: in moveNext()
4308 case MachO::BIND_TYPE_POINTER: in typeName()
4310 case MachO::BIND_TYPE_TEXT_ABSOLUTE32: in typeName()
4312 case MachO::BIND_TYPE_TEXT_PCREL32: in typeName()
4543 MachOObjectFile::isRelocationScattered(const MachO::any_relocation_info &RE) in isRelocationScattered()
4545 if (getCPUType(*this) == MachO::CPU_TYPE_X86_64) in isRelocationScattered()
4547 return getPlainRelocationAddress(RE) & MachO::R_SCATTERED; in isRelocationScattered()
4551 const MachO::any_relocation_info &RE) const { in getPlainRelocationSymbolNum()
4558 const MachO::any_relocation_info &RE) const { in getPlainRelocationExternal()
4565 const MachO::any_relocation_info &RE) const { in getScatteredRelocationScattered()
4570 const MachO::any_relocation_info &RE) const { in getScatteredRelocationValue()
4575 const MachO::any_relocation_info &RE) const { in getScatteredRelocationType()
4580 const MachO::any_relocation_info &RE) const { in getAnyRelocationAddress()
4587 const MachO::any_relocation_info &RE) const { in getAnyRelocationPCRel()
4594 const MachO::any_relocation_info &RE) const { in getAnyRelocationLength()
4602 const MachO::any_relocation_info &RE) const { in getAnyRelocationType()
4610 const MachO::any_relocation_info &RE) const { in getAnyRelocationSection()
4614 if (SecNum == MachO::R_ABS || SecNum > Sections.size()) in getAnyRelocationSection()
4621 MachO::section MachOObjectFile::getSection(DataRefImpl DRI) const { in getSection()
4623 return getStruct<MachO::section>(*this, Sections[DRI.d.a]); in getSection()
4626 MachO::section_64 MachOObjectFile::getSection64(DataRefImpl DRI) const { in getSection64()
4628 return getStruct<MachO::section_64>(*this, Sections[DRI.d.a]); in getSection64()
4631 MachO::section MachOObjectFile::getSection(const LoadCommandInfo &L, in getSection()
4634 return getStruct<MachO::section>(*this, Sec); in getSection()
4637 MachO::section_64 MachOObjectFile::getSection64(const LoadCommandInfo &L, in getSection64()
4640 return getStruct<MachO::section_64>(*this, Sec); in getSection64()
4643 MachO::nlist
4646 return getStruct<MachO::nlist>(*this, P); in getSymbolTableEntry()
4649 MachO::nlist_64
4652 return getStruct<MachO::nlist_64>(*this, P); in getSymbol64TableEntry()
4655 MachO::linkedit_data_command
4657 return getStruct<MachO::linkedit_data_command>(*this, L.Ptr); in getLinkeditDataLoadCommand()
4660 MachO::segment_command
4662 return getStruct<MachO::segment_command>(*this, L.Ptr); in getSegmentLoadCommand()
4665 MachO::segment_command_64
4667 return getStruct<MachO::segment_command_64>(*this, L.Ptr); in getSegment64LoadCommand()
4670 MachO::linker_option_command
4672 return getStruct<MachO::linker_option_command>(*this, L.Ptr); in getLinkerOptionLoadCommand()
4675 MachO::version_min_command
4677 return getStruct<MachO::version_min_command>(*this, L.Ptr); in getVersionMinLoadCommand()
4680 MachO::note_command
4682 return getStruct<MachO::note_command>(*this, L.Ptr); in getNoteLoadCommand()
4685 MachO::build_version_command
4687 return getStruct<MachO::build_version_command>(*this, L.Ptr); in getBuildVersionLoadCommand()
4690 MachO::build_tool_version
4692 return getStruct<MachO::build_tool_version>(*this, BuildTools[index]); in getBuildToolVersion()
4695 MachO::dylib_command
4697 return getStruct<MachO::dylib_command>(*this, L.Ptr); in getDylibIDLoadCommand()
4700 MachO::dyld_info_command
4702 return getStruct<MachO::dyld_info_command>(*this, L.Ptr); in getDyldInfoLoadCommand()
4705 MachO::dylinker_command
4707 return getStruct<MachO::dylinker_command>(*this, L.Ptr); in getDylinkerCommand()
4710 MachO::uuid_command
4712 return getStruct<MachO::uuid_command>(*this, L.Ptr); in getUuidCommand()
4715 MachO::rpath_command
4717 return getStruct<MachO::rpath_command>(*this, L.Ptr); in getRpathCommand()
4720 MachO::source_version_command
4722 return getStruct<MachO::source_version_command>(*this, L.Ptr); in getSourceVersionCommand()
4725 MachO::entry_point_command
4727 return getStruct<MachO::entry_point_command>(*this, L.Ptr); in getEntryPointCommand()
4730 MachO::encryption_info_command
4732 return getStruct<MachO::encryption_info_command>(*this, L.Ptr); in getEncryptionInfoCommand()
4735 MachO::encryption_info_command_64
4737 return getStruct<MachO::encryption_info_command_64>(*this, L.Ptr); in getEncryptionInfoCommand64()
4740 MachO::sub_framework_command
4742 return getStruct<MachO::sub_framework_command>(*this, L.Ptr); in getSubFrameworkCommand()
4745 MachO::sub_umbrella_command
4747 return getStruct<MachO::sub_umbrella_command>(*this, L.Ptr); in getSubUmbrellaCommand()
4750 MachO::sub_library_command
4752 return getStruct<MachO::sub_library_command>(*this, L.Ptr); in getSubLibraryCommand()
4755 MachO::sub_client_command
4757 return getStruct<MachO::sub_client_command>(*this, L.Ptr); in getSubClientCommand()
4760 MachO::routines_command
4762 return getStruct<MachO::routines_command>(*this, L.Ptr); in getRoutinesCommand()
4765 MachO::routines_command_64
4767 return getStruct<MachO::routines_command_64>(*this, L.Ptr); in getRoutinesCommand64()
4770 MachO::thread_command
4772 return getStruct<MachO::thread_command>(*this, L.Ptr); in getThreadCommand()
4775 MachO::fileset_entry_command
4777 return getStruct<MachO::fileset_entry_command>(*this, L.Ptr); in getFilesetEntryLoadCommand()
4780 MachO::any_relocation_info
4783 if (getHeader().filetype == MachO::MH_OBJECT) { in getRelocation()
4787 MachO::section_64 Sect = getSection64(Sec); in getRelocation()
4790 MachO::section Sect = getSection(Sec); in getRelocation()
4794 MachO::dysymtab_command DysymtabLoadCmd = getDysymtabLoadCommand(); in getRelocation()
4801 auto P = reinterpret_cast<const MachO::any_relocation_info *>( in getRelocation()
4803 return getStruct<MachO::any_relocation_info>( in getRelocation()
4807 MachO::data_in_code_entry
4810 return getStruct<MachO::data_in_code_entry>(*this, P); in getDice()
4813 const MachO::mach_header &MachOObjectFile::getHeader() const { in getHeader()
4817 const MachO::mach_header_64 &MachOObjectFile::getHeader64() const { in getHeader64()
4823 const MachO::dysymtab_command &DLC, in getIndirectSymbolTableEntry()
4829 MachO::data_in_code_entry
4832 uint64_t Offset = DataOffset + Index * sizeof(MachO::data_in_code_entry); in getDataInCodeTableEntry()
4833 return getStruct<MachO::data_in_code_entry>(*this, getPtr(*this, Offset)); in getDataInCodeTableEntry()
4836 MachO::symtab_command MachOObjectFile::getSymtabLoadCommand() const { in getSymtabLoadCommand()
4838 return getStruct<MachO::symtab_command>(*this, SymtabLoadCmd); in getSymtabLoadCommand()
4841 MachO::symtab_command Cmd; in getSymtabLoadCommand()
4842 Cmd.cmd = MachO::LC_SYMTAB; in getSymtabLoadCommand()
4843 Cmd.cmdsize = sizeof(MachO::symtab_command); in getSymtabLoadCommand()
4851 MachO::dysymtab_command MachOObjectFile::getDysymtabLoadCommand() const { in getDysymtabLoadCommand()
4853 return getStruct<MachO::dysymtab_command>(*this, DysymtabLoadCmd); in getDysymtabLoadCommand()
4856 MachO::dysymtab_command Cmd; in getDysymtabLoadCommand()
4857 Cmd.cmd = MachO::LC_DYSYMTAB; in getDysymtabLoadCommand()
4858 Cmd.cmdsize = sizeof(MachO::dysymtab_command); in getDysymtabLoadCommand()
4880 MachO::linkedit_data_command
4883 return getStruct<MachO::linkedit_data_command>(*this, DataInCodeLoadCmd); in getDataInCodeLoadCommand()
4886 MachO::linkedit_data_command Cmd; in getDataInCodeLoadCommand()
4887 Cmd.cmd = MachO::LC_DATA_IN_CODE; in getDataInCodeLoadCommand()
4888 Cmd.cmdsize = sizeof(MachO::linkedit_data_command); in getDataInCodeLoadCommand()
4894 MachO::linkedit_data_command
4897 return getStruct<MachO::linkedit_data_command>(*this, LinkOptHintsLoadCmd); in getLinkOptHintsLoadCommand()
4901 MachO::linkedit_data_command Cmd; in getLinkOptHintsLoadCommand()
4902 Cmd.cmd = MachO::LC_LINKER_OPTIMIZATION_HINT; in getLinkOptHintsLoadCommand()
4903 Cmd.cmdsize = sizeof(MachO::linkedit_data_command); in getLinkOptHintsLoadCommand()
4914 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoRebaseOpcodes()
4917 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoRebaseOpcodes()
4928 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoBindOpcodes()
4931 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoBindOpcodes()
4942 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoWeakBindOpcodes()
4945 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoWeakBindOpcodes()
4956 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoLazyBindOpcodes()
4959 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoLazyBindOpcodes()
4970 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoExportsTrie()
4973 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoExportsTrie()
4979 Expected<std::optional<MachO::linkedit_data_command>>
4984 auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>( in getChainedFixupsLoadCommand()
4988 const MachO::linkedit_data_command &DyldChainedFixups = in getChainedFixupsLoadCommand()
4998 Expected<std::optional<MachO::dyld_chained_fixups_header>>
5006 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getChainedFixupsHeader()
5014 getStructOrErr<MachO::dyld_chained_fixups_header>(*this, CFHeaderPtr); in getChainedFixupsHeader()
5017 MachO::dyld_chained_fixups_header CFHeader = CFHeaderOrErr.get(); in getChainedFixupsHeader()
5032 if (CFHeader.starts_offset < sizeof(MachO::dyld_chained_fixups_header)) { in getChainedFixupsHeader()
5038 if (CFImageStartsOffset + sizeof(MachO::dyld_chained_starts_in_image) > in getChainedFixupsHeader()
5042 sizeof(MachO::dyld_chained_starts_in_image)) + in getChainedFixupsHeader()
5059 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getChainedFixupsSegments()
5066 const MachO::dyld_chained_fixups_header &Header = **HeaderOrErr; in getChainedFixupsSegments()
5070 auto ImageStartsOrErr = getStructOrErr<MachO::dyld_chained_starts_in_image>( in getChainedFixupsSegments()
5074 const MachO::dyld_chained_starts_in_image &ImageStarts = *ImageStartsOrErr; in getChainedFixupsSegments()
5078 offsetof(MachO::dyld_chained_starts_in_image, seg_info_offset); in getChainedFixupsSegments()
5106 getStructOrErr<MachO::dyld_chained_starts_in_segment>(*this, SegPtr); in getChainedFixupsSegments()
5109 const MachO::dyld_chained_starts_in_segment &Seg = *SegOrErr; in getChainedFixupsSegments()
5116 SegPtr + offsetof(MachO::dyld_chained_starts_in_segment, page_start); in getChainedFixupsSegments()
5141 if (Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE) || in getEncodedOrdinal()
5142 Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP) || in getEncodedOrdinal()
5143 Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_WEAK_LOOKUP)) in getEncodedOrdinal()
5168 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getDyldChainedFixupTargets()
5175 const MachO::dyld_chained_fixups_header &Header = **CFHeaderOrErr; in getDyldChainedFixupTargets()
5178 if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT) in getDyldChainedFixupTargets()
5179 ImportSize = sizeof(MachO::dyld_chained_import); in getDyldChainedFixupTargets()
5180 else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND) in getDyldChainedFixupTargets()
5181 ImportSize = sizeof(MachO::dyld_chained_import_addend); in getDyldChainedFixupTargets()
5182 else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND64) in getDyldChainedFixupTargets()
5183 ImportSize = sizeof(MachO::dyld_chained_import_addend64); in getDyldChainedFixupTargets()
5215 if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT) { in getDyldChainedFixupTargets()
5216 static_assert(sizeof(uint32_t) == sizeof(MachO::dyld_chained_import)); in getDyldChainedFixupTargets()
5223 } else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND) { in getDyldChainedFixupTargets()
5225 sizeof(MachO::dyld_chained_import_addend)); in getDyldChainedFixupTargets()
5232 } else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND64) { in getDyldChainedFixupTargets()
5234 sizeof(MachO::dyld_chained_import_addend64)); in getDyldChainedFixupTargets()
5260 auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>( in getDyldExportsTrie()
5264 MachO::linkedit_data_command DyldExportsTrie = DyldExportsTrieOrError.get(); in getDyldExportsTrie()
5275 getStructOrErr<MachO::linkedit_data_command>(*this, FuncStartsLoadCmd); in getFunctionStarts()
5279 MachO::linkedit_data_command Info = InfoOrErr.get(); in getFunctionStarts()
5289 const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid); in getUuid()
5294 MachO::symtab_command S = getSymtabLoadCommand(); in getStringTableData()
5316 return getHeader().filetype == MachO::MH_OBJECT; in isRelocatableObject()
5410 return RelocType == MachO::GENERIC_RELOC_SECTDIFF || in isMachOPairedReloc()
5411 RelocType == MachO::GENERIC_RELOC_LOCAL_SECTDIFF; in isMachOPairedReloc()
5413 return RelocType == MachO::X86_64_RELOC_SUBTRACTOR; in isMachOPairedReloc()
5416 return RelocType == MachO::ARM_RELOC_SECTDIFF || in isMachOPairedReloc()
5417 RelocType == MachO::ARM_RELOC_LOCAL_SECTDIFF || in isMachOPairedReloc()
5418 RelocType == MachO::ARM_RELOC_HALF || in isMachOPairedReloc()
5419 RelocType == MachO::ARM_RELOC_HALF_SECTDIFF; in isMachOPairedReloc()
5421 return RelocType == MachO::ARM64_RELOC_SUBTRACTOR; in isMachOPairedReloc()