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()
3516 uint8_t ImmValue = Byte & MachO::REBASE_IMMEDIATE_MASK; in moveNext()
3517 uint8_t Opcode = Byte & MachO::REBASE_OPCODE_MASK; in moveNext()
3521 case MachO::REBASE_OPCODE_DONE: in moveNext()
3527 case MachO::REBASE_OPCODE_SET_TYPE_IMM: in moveNext()
3529 if (RebaseType > MachO::REBASE_TYPE_TEXT_PCREL32) { in moveNext()
3541 case MachO::REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: in moveNext()
3567 case MachO::REBASE_OPCODE_ADD_ADDR_ULEB: in moveNext()
3590 case MachO::REBASE_OPCODE_ADD_ADDR_IMM_SCALED: in moveNext()
3606 case MachO::REBASE_OPCODE_DO_REBASE_IMM_TIMES: in moveNext()
3631 case MachO::REBASE_OPCODE_DO_REBASE_ULEB_TIMES: in moveNext()
3663 case MachO::REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB: in moveNext()
3692 case MachO::REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB: in moveNext()
3760 case MachO::REBASE_TYPE_POINTER: in typeName()
3762 case MachO::REBASE_TYPE_TEXT_ABSOLUTE32: in typeName()
3764 case MachO::REBASE_TYPE_TEXT_PCREL32: in typeName()
3853 uint8_t ImmValue = Byte & MachO::BIND_IMMEDIATE_MASK; in moveNext()
3854 uint8_t Opcode = Byte & MachO::BIND_OPCODE_MASK; in moveNext()
3860 case MachO::BIND_OPCODE_DONE: in moveNext()
3877 case MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_IMM: in moveNext()
3902 case MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: in moveNext()
3934 case MachO::BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: in moveNext()
3943 SignExtended = MachO::BIND_OPCODE_MASK | ImmValue; in moveNext()
3945 if (Ordinal < MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP) { in moveNext()
3961 case MachO::BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: in moveNext()
3983 if (ImmValue & MachO::BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION) in moveNext()
3987 case MachO::BIND_OPCODE_SET_TYPE_IMM: in moveNext()
3989 if (ImmValue > MachO::BIND_TYPE_TEXT_PCREL32) { in moveNext()
4001 case MachO::BIND_OPCODE_SET_ADDEND_SLEB: in moveNext()
4015 case MachO::BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB: in moveNext()
4041 case MachO::BIND_OPCODE_ADD_ADDR_ULEB: in moveNext()
4064 case MachO::BIND_OPCODE_DO_BIND: in moveNext()
4097 case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: in moveNext()
4161 case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: in moveNext()
4203 case MachO::BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: in moveNext()
4304 case MachO::BIND_TYPE_POINTER: in typeName()
4306 case MachO::BIND_TYPE_TEXT_ABSOLUTE32: in typeName()
4308 case MachO::BIND_TYPE_TEXT_PCREL32: in typeName()
4539 MachOObjectFile::isRelocationScattered(const MachO::any_relocation_info &RE) in isRelocationScattered()
4541 if (getCPUType(*this) == MachO::CPU_TYPE_X86_64) in isRelocationScattered()
4543 return getPlainRelocationAddress(RE) & MachO::R_SCATTERED; in isRelocationScattered()
4547 const MachO::any_relocation_info &RE) const { in getPlainRelocationSymbolNum()
4554 const MachO::any_relocation_info &RE) const { in getPlainRelocationExternal()
4561 const MachO::any_relocation_info &RE) const { in getScatteredRelocationScattered()
4566 const MachO::any_relocation_info &RE) const { in getScatteredRelocationValue()
4571 const MachO::any_relocation_info &RE) const { in getScatteredRelocationType()
4576 const MachO::any_relocation_info &RE) const { in getAnyRelocationAddress()
4583 const MachO::any_relocation_info &RE) const { in getAnyRelocationPCRel()
4590 const MachO::any_relocation_info &RE) const { in getAnyRelocationLength()
4598 const MachO::any_relocation_info &RE) const { in getAnyRelocationType()
4606 const MachO::any_relocation_info &RE) const { in getAnyRelocationSection()
4610 if (SecNum == MachO::R_ABS || SecNum > Sections.size()) in getAnyRelocationSection()
4617 MachO::section MachOObjectFile::getSection(DataRefImpl DRI) const { in getSection()
4619 return getStruct<MachO::section>(*this, Sections[DRI.d.a]); in getSection()
4622 MachO::section_64 MachOObjectFile::getSection64(DataRefImpl DRI) const { in getSection64()
4624 return getStruct<MachO::section_64>(*this, Sections[DRI.d.a]); in getSection64()
4627 MachO::section MachOObjectFile::getSection(const LoadCommandInfo &L, in getSection()
4630 return getStruct<MachO::section>(*this, Sec); in getSection()
4633 MachO::section_64 MachOObjectFile::getSection64(const LoadCommandInfo &L, in getSection64()
4636 return getStruct<MachO::section_64>(*this, Sec); in getSection64()
4639 MachO::nlist
4642 return getStruct<MachO::nlist>(*this, P); in getSymbolTableEntry()
4645 MachO::nlist_64
4648 return getStruct<MachO::nlist_64>(*this, P); in getSymbol64TableEntry()
4651 MachO::linkedit_data_command
4653 return getStruct<MachO::linkedit_data_command>(*this, L.Ptr); in getLinkeditDataLoadCommand()
4656 MachO::segment_command
4658 return getStruct<MachO::segment_command>(*this, L.Ptr); in getSegmentLoadCommand()
4661 MachO::segment_command_64
4663 return getStruct<MachO::segment_command_64>(*this, L.Ptr); in getSegment64LoadCommand()
4666 MachO::linker_option_command
4668 return getStruct<MachO::linker_option_command>(*this, L.Ptr); in getLinkerOptionLoadCommand()
4671 MachO::version_min_command
4673 return getStruct<MachO::version_min_command>(*this, L.Ptr); in getVersionMinLoadCommand()
4676 MachO::note_command
4678 return getStruct<MachO::note_command>(*this, L.Ptr); in getNoteLoadCommand()
4681 MachO::build_version_command
4683 return getStruct<MachO::build_version_command>(*this, L.Ptr); in getBuildVersionLoadCommand()
4686 MachO::build_tool_version
4688 return getStruct<MachO::build_tool_version>(*this, BuildTools[index]); in getBuildToolVersion()
4691 MachO::dylib_command
4693 return getStruct<MachO::dylib_command>(*this, L.Ptr); in getDylibIDLoadCommand()
4696 MachO::dyld_info_command
4698 return getStruct<MachO::dyld_info_command>(*this, L.Ptr); in getDyldInfoLoadCommand()
4701 MachO::dylinker_command
4703 return getStruct<MachO::dylinker_command>(*this, L.Ptr); in getDylinkerCommand()
4706 MachO::uuid_command
4708 return getStruct<MachO::uuid_command>(*this, L.Ptr); in getUuidCommand()
4711 MachO::rpath_command
4713 return getStruct<MachO::rpath_command>(*this, L.Ptr); in getRpathCommand()
4716 MachO::source_version_command
4718 return getStruct<MachO::source_version_command>(*this, L.Ptr); in getSourceVersionCommand()
4721 MachO::entry_point_command
4723 return getStruct<MachO::entry_point_command>(*this, L.Ptr); in getEntryPointCommand()
4726 MachO::encryption_info_command
4728 return getStruct<MachO::encryption_info_command>(*this, L.Ptr); in getEncryptionInfoCommand()
4731 MachO::encryption_info_command_64
4733 return getStruct<MachO::encryption_info_command_64>(*this, L.Ptr); in getEncryptionInfoCommand64()
4736 MachO::sub_framework_command
4738 return getStruct<MachO::sub_framework_command>(*this, L.Ptr); in getSubFrameworkCommand()
4741 MachO::sub_umbrella_command
4743 return getStruct<MachO::sub_umbrella_command>(*this, L.Ptr); in getSubUmbrellaCommand()
4746 MachO::sub_library_command
4748 return getStruct<MachO::sub_library_command>(*this, L.Ptr); in getSubLibraryCommand()
4751 MachO::sub_client_command
4753 return getStruct<MachO::sub_client_command>(*this, L.Ptr); in getSubClientCommand()
4756 MachO::routines_command
4758 return getStruct<MachO::routines_command>(*this, L.Ptr); in getRoutinesCommand()
4761 MachO::routines_command_64
4763 return getStruct<MachO::routines_command_64>(*this, L.Ptr); in getRoutinesCommand64()
4766 MachO::thread_command
4768 return getStruct<MachO::thread_command>(*this, L.Ptr); in getThreadCommand()
4771 MachO::fileset_entry_command
4773 return getStruct<MachO::fileset_entry_command>(*this, L.Ptr); in getFilesetEntryLoadCommand()
4776 MachO::any_relocation_info
4779 if (getHeader().filetype == MachO::MH_OBJECT) { in getRelocation()
4783 MachO::section_64 Sect = getSection64(Sec); in getRelocation()
4786 MachO::section Sect = getSection(Sec); in getRelocation()
4790 MachO::dysymtab_command DysymtabLoadCmd = getDysymtabLoadCommand(); in getRelocation()
4797 auto P = reinterpret_cast<const MachO::any_relocation_info *>( in getRelocation()
4799 return getStruct<MachO::any_relocation_info>( in getRelocation()
4803 MachO::data_in_code_entry
4806 return getStruct<MachO::data_in_code_entry>(*this, P); in getDice()
4809 const MachO::mach_header &MachOObjectFile::getHeader() const { in getHeader()
4813 const MachO::mach_header_64 &MachOObjectFile::getHeader64() const { in getHeader64()
4819 const MachO::dysymtab_command &DLC, in getIndirectSymbolTableEntry()
4825 MachO::data_in_code_entry
4828 uint64_t Offset = DataOffset + Index * sizeof(MachO::data_in_code_entry); in getDataInCodeTableEntry()
4829 return getStruct<MachO::data_in_code_entry>(*this, getPtr(*this, Offset)); in getDataInCodeTableEntry()
4832 MachO::symtab_command MachOObjectFile::getSymtabLoadCommand() const { in getSymtabLoadCommand()
4834 return getStruct<MachO::symtab_command>(*this, SymtabLoadCmd); in getSymtabLoadCommand()
4837 MachO::symtab_command Cmd; in getSymtabLoadCommand()
4838 Cmd.cmd = MachO::LC_SYMTAB; in getSymtabLoadCommand()
4839 Cmd.cmdsize = sizeof(MachO::symtab_command); in getSymtabLoadCommand()
4847 MachO::dysymtab_command MachOObjectFile::getDysymtabLoadCommand() const { in getDysymtabLoadCommand()
4849 return getStruct<MachO::dysymtab_command>(*this, DysymtabLoadCmd); in getDysymtabLoadCommand()
4852 MachO::dysymtab_command Cmd; in getDysymtabLoadCommand()
4853 Cmd.cmd = MachO::LC_DYSYMTAB; in getDysymtabLoadCommand()
4854 Cmd.cmdsize = sizeof(MachO::dysymtab_command); in getDysymtabLoadCommand()
4876 MachO::linkedit_data_command
4879 return getStruct<MachO::linkedit_data_command>(*this, DataInCodeLoadCmd); in getDataInCodeLoadCommand()
4882 MachO::linkedit_data_command Cmd; in getDataInCodeLoadCommand()
4883 Cmd.cmd = MachO::LC_DATA_IN_CODE; in getDataInCodeLoadCommand()
4884 Cmd.cmdsize = sizeof(MachO::linkedit_data_command); in getDataInCodeLoadCommand()
4890 MachO::linkedit_data_command
4893 return getStruct<MachO::linkedit_data_command>(*this, LinkOptHintsLoadCmd); in getLinkOptHintsLoadCommand()
4897 MachO::linkedit_data_command Cmd; in getLinkOptHintsLoadCommand()
4898 Cmd.cmd = MachO::LC_LINKER_OPTIMIZATION_HINT; in getLinkOptHintsLoadCommand()
4899 Cmd.cmdsize = sizeof(MachO::linkedit_data_command); in getLinkOptHintsLoadCommand()
4910 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoRebaseOpcodes()
4913 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoRebaseOpcodes()
4924 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoBindOpcodes()
4927 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoBindOpcodes()
4938 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoWeakBindOpcodes()
4941 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoWeakBindOpcodes()
4952 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoLazyBindOpcodes()
4955 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoLazyBindOpcodes()
4966 getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); in getDyldInfoExportsTrie()
4969 MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); in getDyldInfoExportsTrie()
4975 Expected<std::optional<MachO::linkedit_data_command>>
4980 auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>( in getChainedFixupsLoadCommand()
4984 const MachO::linkedit_data_command &DyldChainedFixups = in getChainedFixupsLoadCommand()
4994 Expected<std::optional<MachO::dyld_chained_fixups_header>>
5002 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getChainedFixupsHeader()
5010 getStructOrErr<MachO::dyld_chained_fixups_header>(*this, CFHeaderPtr); in getChainedFixupsHeader()
5013 MachO::dyld_chained_fixups_header CFHeader = CFHeaderOrErr.get(); in getChainedFixupsHeader()
5028 if (CFHeader.starts_offset < sizeof(MachO::dyld_chained_fixups_header)) { in getChainedFixupsHeader()
5034 if (CFImageStartsOffset + sizeof(MachO::dyld_chained_starts_in_image) > in getChainedFixupsHeader()
5038 sizeof(MachO::dyld_chained_starts_in_image)) + in getChainedFixupsHeader()
5055 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getChainedFixupsSegments()
5062 const MachO::dyld_chained_fixups_header &Header = **HeaderOrErr; in getChainedFixupsSegments()
5066 auto ImageStartsOrErr = getStructOrErr<MachO::dyld_chained_starts_in_image>( in getChainedFixupsSegments()
5070 const MachO::dyld_chained_starts_in_image &ImageStarts = *ImageStartsOrErr; in getChainedFixupsSegments()
5074 offsetof(MachO::dyld_chained_starts_in_image, seg_info_offset); in getChainedFixupsSegments()
5102 getStructOrErr<MachO::dyld_chained_starts_in_segment>(*this, SegPtr); in getChainedFixupsSegments()
5105 const MachO::dyld_chained_starts_in_segment &Seg = *SegOrErr; in getChainedFixupsSegments()
5112 SegPtr + offsetof(MachO::dyld_chained_starts_in_segment, page_start); in getChainedFixupsSegments()
5137 if (Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE) || in getEncodedOrdinal()
5138 Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP) || in getEncodedOrdinal()
5139 Value == static_cast<T>(MachO::BIND_SPECIAL_DYLIB_WEAK_LOOKUP)) in getEncodedOrdinal()
5164 const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; in getDyldChainedFixupTargets()
5171 const MachO::dyld_chained_fixups_header &Header = **CFHeaderOrErr; in getDyldChainedFixupTargets()
5174 if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT) in getDyldChainedFixupTargets()
5175 ImportSize = sizeof(MachO::dyld_chained_import); in getDyldChainedFixupTargets()
5176 else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND) in getDyldChainedFixupTargets()
5177 ImportSize = sizeof(MachO::dyld_chained_import_addend); in getDyldChainedFixupTargets()
5178 else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND64) in getDyldChainedFixupTargets()
5179 ImportSize = sizeof(MachO::dyld_chained_import_addend64); in getDyldChainedFixupTargets()
5211 if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT) { in getDyldChainedFixupTargets()
5212 static_assert(sizeof(uint32_t) == sizeof(MachO::dyld_chained_import)); in getDyldChainedFixupTargets()
5219 } else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND) { in getDyldChainedFixupTargets()
5221 sizeof(MachO::dyld_chained_import_addend)); in getDyldChainedFixupTargets()
5228 } else if (Header.imports_format == MachO::DYLD_CHAINED_IMPORT_ADDEND64) { in getDyldChainedFixupTargets()
5230 sizeof(MachO::dyld_chained_import_addend64)); in getDyldChainedFixupTargets()
5256 auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>( in getDyldExportsTrie()
5260 MachO::linkedit_data_command DyldExportsTrie = DyldExportsTrieOrError.get(); in getDyldExportsTrie()
5271 getStructOrErr<MachO::linkedit_data_command>(*this, FuncStartsLoadCmd); in getFunctionStarts()
5275 MachO::linkedit_data_command Info = InfoOrErr.get(); in getFunctionStarts()
5285 const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid); in getUuid()
5290 MachO::symtab_command S = getSymtabLoadCommand(); in getStringTableData()
5312 return getHeader().filetype == MachO::MH_OBJECT; in isRelocatableObject()
5406 return RelocType == MachO::GENERIC_RELOC_SECTDIFF || in isMachOPairedReloc()
5407 RelocType == MachO::GENERIC_RELOC_LOCAL_SECTDIFF; in isMachOPairedReloc()
5409 return RelocType == MachO::X86_64_RELOC_SUBTRACTOR; in isMachOPairedReloc()
5412 return RelocType == MachO::ARM_RELOC_SECTDIFF || in isMachOPairedReloc()
5413 RelocType == MachO::ARM_RELOC_LOCAL_SECTDIFF || in isMachOPairedReloc()
5414 RelocType == MachO::ARM_RELOC_HALF || in isMachOPairedReloc()
5415 RelocType == MachO::ARM_RELOC_HALF_SECTDIFF; in isMachOPairedReloc()
5417 return RelocType == MachO::ARM64_RELOC_SUBTRACTOR; in isMachOPairedReloc()