Lines Matching +full:auto +full:- +full:load

1 //===- MachOObjectFile.cpp - Mach-O object file binding -------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
87 return malformedError("Structure read out-of-range"); in getStructOrErr()
194 if (auto CmdOrErr = getStructOrErr<MachO::load_command>(Obj, Ptr)) { in getLoadCommandInfo()
195 if (CmdOrErr->cmdsize + Ptr > Obj.getData().end()) in getLoadCommandInfo()
196 return malformedError("load command " + Twine(LoadCommandIndex) + in getLoadCommandInfo()
198 if (CmdOrErr->cmdsize < 8) in getLoadCommandInfo()
199 return malformedError("load command " + Twine(LoadCommandIndex) + in getLoadCommandInfo()
211 return malformedError("load command 0 extends past the end all load " in getFirstLoadCommandInfo()
225 return malformedError("load command " + Twine(LoadCommandIndex + 1) + in getNextLoadCommandInfo()
226 " extends past the end all load commands in the file"); in getNextLoadCommandInfo()
238 if (auto HeaderOrErr = getStructOrErr<T>( in parseHeader()
245 // This is used to check for overlapping of Mach-O elements.
258 for (auto it = Elements.begin(); it != Elements.end(); ++it) { in checkOverlappingElement()
259 const auto &E = *it; in checkOverlappingElement()
267 auto nt = it; in checkOverlappingElement()
270 const auto &N = *nt; in checkOverlappingElement()
281 // Parses LC_SEGMENT or LC_SEGMENT_64 load command, adds addresses of all
286 const MachOObjectFile &Obj, const MachOObjectFile::LoadCommandInfo &Load, in parseSegmentLoadCommand() argument
291 if (Load.C.cmdsize < SegmentLoadSize) in parseSegmentLoadCommand()
292 return malformedError("load command " + Twine(LoadCommandIndex) + in parseSegmentLoadCommand()
294 if (auto SegOrErr = getStructOrErr<Segment>(Obj, Load.Ptr)) { in parseSegmentLoadCommand()
299 S.nsects * SectionSize > Load.C.cmdsize - SegmentLoadSize) in parseSegmentLoadCommand()
300 return malformedError("load command " + Twine(LoadCommandIndex) + in parseSegmentLoadCommand()
304 const char *Sec = getSectionPtr(Obj, Load, J); in parseSegmentLoadCommand()
306 auto SectionOrErr = getStructOrErr<Section>(Obj, Sec); in parseSegmentLoadCommand()
389 return malformedError("load command " + Twine(LoadCommandIndex) + in parseSegmentLoadCommand()
395 return malformedError("load command " + Twine(LoadCommandIndex) + in parseSegmentLoadCommand()
399 return malformedError("load command " + Twine(LoadCommandIndex) + in parseSegmentLoadCommand()
410 const MachOObjectFile::LoadCommandInfo &Load, in checkSymtabCommand() argument
414 if (Load.C.cmdsize < sizeof(MachO::symtab_command)) in checkSymtabCommand()
415 return malformedError("load command " + Twine(LoadCommandIndex) + in checkSymtabCommand()
419 auto SymtabOrErr = getStructOrErr<MachO::symtab_command>(Obj, Load.Ptr); in checkSymtabCommand()
463 *SymtabLoadCmd = Load.Ptr; in checkSymtabCommand()
468 const MachOObjectFile::LoadCommandInfo &Load, in checkDysymtabCommand() argument
472 if (Load.C.cmdsize < sizeof(MachO::dysymtab_command)) in checkDysymtabCommand()
473 return malformedError("load command " + Twine(LoadCommandIndex) + in checkDysymtabCommand()
477 auto DysymtabOrErr = in checkDysymtabCommand()
478 getStructOrErr<MachO::dysymtab_command>(Obj, Load.Ptr); in checkDysymtabCommand()
596 *DysymtabLoadCmd = Load.Ptr; in checkDysymtabCommand()
601 const MachOObjectFile::LoadCommandInfo &Load, in checkLinkeditDataCommand() argument
606 if (Load.C.cmdsize < sizeof(MachO::linkedit_data_command)) in checkLinkeditDataCommand()
607 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkLinkeditDataCommand()
611 auto LinkDataOrError = in checkLinkeditDataCommand()
612 getStructOrErr<MachO::linkedit_data_command>(Obj, Load.Ptr); in checkLinkeditDataCommand()
634 *LoadCmd = Load.Ptr; in checkLinkeditDataCommand()
639 const MachOObjectFile::LoadCommandInfo &Load, in checkDyldInfoCommand() argument
643 if (Load.C.cmdsize < sizeof(MachO::dyld_info_command)) in checkDyldInfoCommand()
644 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDyldInfoCommand()
649 auto DyldInfoOrErr = in checkDyldInfoCommand()
650 getStructOrErr<MachO::dyld_info_command>(Obj, Load.Ptr); in checkDyldInfoCommand()
733 *LoadCmd = Load.Ptr; in checkDyldInfoCommand()
738 const MachOObjectFile::LoadCommandInfo &Load, in checkDylibCommand() argument
740 if (Load.C.cmdsize < sizeof(MachO::dylib_command)) in checkDylibCommand()
741 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDylibCommand()
743 auto CommandOrErr = getStructOrErr<MachO::dylib_command>(Obj, Load.Ptr); in checkDylibCommand()
748 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDylibCommand()
752 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDylibCommand()
754 "of the load command"); in checkDylibCommand()
756 // the end of the load command. in checkDylibCommand()
758 const char *P = (const char *)Load.Ptr; in checkDylibCommand()
763 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDylibCommand()
765 "load command"); in checkDylibCommand()
770 const MachOObjectFile::LoadCommandInfo &Load, in checkDylibIdCommand() argument
773 if (Error Err = checkDylibCommand(Obj, Load, LoadCommandIndex, in checkDylibIdCommand()
780 return malformedError("LC_ID_DYLIB load command in non-dynamic library " in checkDylibIdCommand()
782 *LoadCmd = Load.Ptr; in checkDylibIdCommand()
787 const MachOObjectFile::LoadCommandInfo &Load, in checkDyldCommand() argument
789 if (Load.C.cmdsize < sizeof(MachO::dylinker_command)) in checkDyldCommand()
790 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDyldCommand()
792 auto CommandOrErr = getStructOrErr<MachO::dylinker_command>(Obj, Load.Ptr); in checkDyldCommand()
797 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDyldCommand()
801 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDyldCommand()
803 "of the load command"); in checkDyldCommand()
805 // the end of the load command. in checkDyldCommand()
807 const char *P = (const char *)Load.Ptr; in checkDyldCommand()
812 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkDyldCommand()
814 "load command"); in checkDyldCommand()
819 const MachOObjectFile::LoadCommandInfo &Load, in checkVersCommand() argument
822 if (Load.C.cmdsize != sizeof(MachO::version_min_command)) in checkVersCommand()
823 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkVersCommand()
829 *LoadCmd = Load.Ptr; in checkVersCommand()
834 const MachOObjectFile::LoadCommandInfo &Load, in checkNoteCommand() argument
837 if (Load.C.cmdsize != sizeof(MachO::note_command)) in checkNoteCommand()
838 return malformedError("load command " + Twine(LoadCommandIndex) + in checkNoteCommand()
840 auto NoteCmdOrErr = getStructOrErr<MachO::note_command>(Obj, Load.Ptr); in checkNoteCommand()
863 const MachOObjectFile::LoadCommandInfo &Load, in parseBuildVersionCommand() argument
866 auto BVCOrErr = in parseBuildVersionCommand()
867 getStructOrErr<MachO::build_version_command>(Obj, Load.Ptr); in parseBuildVersionCommand()
871 if (Load.C.cmdsize != in parseBuildVersionCommand()
874 return malformedError("load command " + Twine(LoadCommandIndex) + in parseBuildVersionCommand()
877 auto Start = Load.Ptr + sizeof(MachO::build_version_command); in parseBuildVersionCommand()
886 const MachOObjectFile::LoadCommandInfo &Load, in checkRpathCommand() argument
888 if (Load.C.cmdsize < sizeof(MachO::rpath_command)) in checkRpathCommand()
889 return malformedError("load command " + Twine(LoadCommandIndex) + in checkRpathCommand()
891 auto ROrErr = getStructOrErr<MachO::rpath_command>(Obj, Load.Ptr); in checkRpathCommand()
896 return malformedError("load command " + Twine(LoadCommandIndex) + in checkRpathCommand()
900 return malformedError("load command " + Twine(LoadCommandIndex) + in checkRpathCommand()
902 "of the load command"); in checkRpathCommand()
904 // the end of the load command. in checkRpathCommand()
906 const char *P = (const char *)Load.Ptr; in checkRpathCommand()
911 return malformedError("load command " + Twine(LoadCommandIndex) + in checkRpathCommand()
913 "load command"); in checkRpathCommand()
918 const MachOObjectFile::LoadCommandInfo &Load, in checkEncryptCommand() argument
937 *LoadCmd = Load.Ptr; in checkEncryptCommand()
942 const MachOObjectFile::LoadCommandInfo &Load, in checkLinkerOptCommand() argument
944 if (Load.C.cmdsize < sizeof(MachO::linker_option_command)) in checkLinkerOptCommand()
945 return malformedError("load command " + Twine(LoadCommandIndex) + in checkLinkerOptCommand()
947 auto LinkOptionOrErr = in checkLinkerOptCommand()
948 getStructOrErr<MachO::linker_option_command>(Obj, Load.Ptr); in checkLinkerOptCommand()
953 const char *string = (const char *)Load.Ptr + in checkLinkerOptCommand()
955 uint32_t left = L.cmdsize - sizeof(struct MachO::linker_option_command); in checkLinkerOptCommand()
960 left--; in checkLinkerOptCommand()
966 return malformedError("load command " + Twine(LoadCommandIndex) + in checkLinkerOptCommand()
971 left -= len; in checkLinkerOptCommand()
975 return malformedError("load command " + Twine(LoadCommandIndex) + in checkLinkerOptCommand()
982 const MachOObjectFile::LoadCommandInfo &Load, in checkSubCommand() argument
987 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkSubCommand()
990 if (PathOffset >= Load.C.cmdsize) in checkSubCommand()
991 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkSubCommand()
993 "extends past the end of the load command"); in checkSubCommand()
995 // the end of the load command. in checkSubCommand()
997 const char *P = (const char *)Load.Ptr; in checkSubCommand()
998 for (i = PathOffset; i < Load.C.cmdsize; i++) in checkSubCommand()
1001 if (i >= Load.C.cmdsize) in checkSubCommand()
1002 return malformedError("load command " + Twine(LoadCommandIndex) + " " + in checkSubCommand()
1004 "the end of the load command"); in checkSubCommand()
1009 const MachOObjectFile::LoadCommandInfo &Load, in checkThreadCommand() argument
1012 if (Load.C.cmdsize < sizeof(MachO::thread_command)) in checkThreadCommand()
1013 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1015 auto ThreadCommandOrErr = in checkThreadCommand()
1016 getStructOrErr<MachO::thread_command>(Obj, Load.Ptr); in checkThreadCommand()
1020 const char *state = Load.Ptr + sizeof(MachO::thread_command); in checkThreadCommand()
1021 const char *end = Load.Ptr + T.cmdsize; in checkThreadCommand()
1026 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1036 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1048 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1054 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1059 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1067 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1073 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1079 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1085 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1091 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1097 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1103 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1109 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1115 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1121 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1126 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1134 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1140 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1145 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1154 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1160 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1165 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1173 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1179 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1184 return malformedError("load command " + Twine(LoadCommandIndex) + in checkThreadCommand()
1190 return malformedError("unknown cputype (" + Twine(cputype) + ") load " in checkThreadCommand()
1201 &Load, in checkTwoLevelHintsCommand() argument
1205 if (Load.C.cmdsize != sizeof(MachO::twolevel_hints_command)) in checkTwoLevelHintsCommand()
1206 return malformedError("load command " + Twine(LoadCommandIndex) + in checkTwoLevelHintsCommand()
1210 auto HintsOrErr = getStructOrErr<MachO::twolevel_hints_command>(Obj, Load.Ptr); in checkTwoLevelHintsCommand()
1231 *LoadCmd = Load.Ptr; in checkTwoLevelHintsCommand()
1235 // Returns true if the libObject code does not support the load command and its
1236 // contents. The cmd value it is treated as an unknown load command but with
1289 Err = malformedError("load commands extend past the end of the file"); in MachOObjectFile()
1299 Elements.push_back({0, SizeOfHeaders, "Mach-O headers"}); in MachOObjectFile()
1302 LoadCommandInfo Load; in MachOObjectFile() local
1304 if (auto LoadOrErr = getFirstLoadCommandInfo(*this)) in MachOObjectFile()
1305 Load = *LoadOrErr; in MachOObjectFile()
1325 if (Load.C.cmdsize % 8 != 0) { in MachOObjectFile()
1326 // We have a hack here to allow 64-bit Mach-O core files to have in MachOObjectFile()
1330 Load.C.cmd != MachO::LC_THREAD || Load.C.cmdsize % 4) { in MachOObjectFile()
1331 Err = malformedError("load command " + Twine(I) + " cmdsize not a " in MachOObjectFile()
1337 if (Load.C.cmdsize % 4 != 0) { in MachOObjectFile()
1338 Err = malformedError("load command " + Twine(I) + " cmdsize not a " in MachOObjectFile()
1343 LoadCommands.push_back(Load); in MachOObjectFile()
1344 if (Load.C.cmd == MachO::LC_SYMTAB) { in MachOObjectFile()
1345 if ((Err = checkSymtabCommand(*this, Load, I, &SymtabLoadCmd, Elements))) in MachOObjectFile()
1347 } else if (Load.C.cmd == MachO::LC_DYSYMTAB) { in MachOObjectFile()
1348 if ((Err = checkDysymtabCommand(*this, Load, I, &DysymtabLoadCmd, in MachOObjectFile()
1351 } else if (Load.C.cmd == MachO::LC_DATA_IN_CODE) { in MachOObjectFile()
1352 if ((Err = checkLinkeditDataCommand(*this, Load, I, &DataInCodeLoadCmd, in MachOObjectFile()
1356 } else if (Load.C.cmd == MachO::LC_LINKER_OPTIMIZATION_HINT) { in MachOObjectFile()
1357 if ((Err = checkLinkeditDataCommand(*this, Load, I, &LinkOptHintsLoadCmd, in MachOObjectFile()
1362 } else if (Load.C.cmd == MachO::LC_FUNCTION_STARTS) { in MachOObjectFile()
1363 if ((Err = checkLinkeditDataCommand(*this, Load, I, &FuncStartsLoadCmd, in MachOObjectFile()
1367 } else if (Load.C.cmd == MachO::LC_SEGMENT_SPLIT_INFO) { in MachOObjectFile()
1368 if ((Err = checkLinkeditDataCommand(*this, Load, I, &SplitInfoLoadCmd, in MachOObjectFile()
1372 } else if (Load.C.cmd == MachO::LC_DYLIB_CODE_SIGN_DRS) { in MachOObjectFile()
1373 if ((Err = checkLinkeditDataCommand(*this, Load, I, &CodeSignDrsLoadCmd, in MachOObjectFile()
1377 } else if (Load.C.cmd == MachO::LC_CODE_SIGNATURE) { in MachOObjectFile()
1378 if ((Err = checkLinkeditDataCommand(*this, Load, I, &CodeSignLoadCmd, in MachOObjectFile()
1382 } else if (Load.C.cmd == MachO::LC_DYLD_INFO) { in MachOObjectFile()
1383 if ((Err = checkDyldInfoCommand(*this, Load, I, &DyldInfoLoadCmd, in MachOObjectFile()
1386 } else if (Load.C.cmd == MachO::LC_DYLD_INFO_ONLY) { in MachOObjectFile()
1387 if ((Err = checkDyldInfoCommand(*this, Load, I, &DyldInfoLoadCmd, in MachOObjectFile()
1390 } else if (Load.C.cmd == MachO::LC_DYLD_CHAINED_FIXUPS) { in MachOObjectFile()
1392 *this, Load, I, &DyldChainedFixupsLoadCmd, in MachOObjectFile()
1395 } else if (Load.C.cmd == MachO::LC_DYLD_EXPORTS_TRIE) { in MachOObjectFile()
1397 *this, Load, I, &DyldExportsTrieLoadCmd, "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()
1410 UuidLoadCmd = Load.Ptr; in MachOObjectFile()
1411 } else if (Load.C.cmd == MachO::LC_SEGMENT_64) { in MachOObjectFile()
1414 *this, Load, Sections, HasPageZeroSegment, I, in MachOObjectFile()
1417 } else if (Load.C.cmd == MachO::LC_SEGMENT) { in MachOObjectFile()
1420 *this, Load, Sections, HasPageZeroSegment, I, in MachOObjectFile()
1423 } else if (Load.C.cmd == MachO::LC_ID_DYLIB) { in MachOObjectFile()
1424 if ((Err = checkDylibIdCommand(*this, Load, I, &DyldIdLoadCmd))) in MachOObjectFile()
1426 } else if (Load.C.cmd == MachO::LC_LOAD_DYLIB) { in MachOObjectFile()
1427 if ((Err = checkDylibCommand(*this, Load, I, "LC_LOAD_DYLIB"))) in MachOObjectFile()
1429 Libraries.push_back(Load.Ptr); in MachOObjectFile()
1430 } else if (Load.C.cmd == MachO::LC_LOAD_WEAK_DYLIB) { in MachOObjectFile()
1431 if ((Err = checkDylibCommand(*this, Load, I, "LC_LOAD_WEAK_DYLIB"))) in MachOObjectFile()
1433 Libraries.push_back(Load.Ptr); in MachOObjectFile()
1434 } else if (Load.C.cmd == MachO::LC_LAZY_LOAD_DYLIB) { in MachOObjectFile()
1435 if ((Err = checkDylibCommand(*this, Load, I, "LC_LAZY_LOAD_DYLIB"))) in MachOObjectFile()
1437 Libraries.push_back(Load.Ptr); in MachOObjectFile()
1438 } else if (Load.C.cmd == MachO::LC_REEXPORT_DYLIB) { in MachOObjectFile()
1439 if ((Err = checkDylibCommand(*this, Load, I, "LC_REEXPORT_DYLIB"))) in MachOObjectFile()
1441 Libraries.push_back(Load.Ptr); in MachOObjectFile()
1442 } else if (Load.C.cmd == MachO::LC_LOAD_UPWARD_DYLIB) { in MachOObjectFile()
1443 if ((Err = checkDylibCommand(*this, Load, I, "LC_LOAD_UPWARD_DYLIB"))) in MachOObjectFile()
1445 Libraries.push_back(Load.Ptr); in MachOObjectFile()
1446 } else if (Load.C.cmd == MachO::LC_ID_DYLINKER) { in MachOObjectFile()
1447 if ((Err = checkDyldCommand(*this, Load, I, "LC_ID_DYLINKER"))) in MachOObjectFile()
1449 } else if (Load.C.cmd == MachO::LC_LOAD_DYLINKER) { in MachOObjectFile()
1450 if ((Err = checkDyldCommand(*this, Load, I, "LC_LOAD_DYLINKER"))) in MachOObjectFile()
1452 } else if (Load.C.cmd == MachO::LC_DYLD_ENVIRONMENT) { in MachOObjectFile()
1453 if ((Err = checkDyldCommand(*this, Load, I, "LC_DYLD_ENVIRONMENT"))) in MachOObjectFile()
1455 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_MACOSX) { in MachOObjectFile()
1456 if ((Err = checkVersCommand(*this, Load, I, &VersLoadCmd, in MachOObjectFile()
1459 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_IPHONEOS) { in MachOObjectFile()
1460 if ((Err = checkVersCommand(*this, Load, I, &VersLoadCmd, in MachOObjectFile()
1463 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_TVOS) { in MachOObjectFile()
1464 if ((Err = checkVersCommand(*this, Load, I, &VersLoadCmd, in MachOObjectFile()
1467 } else if (Load.C.cmd == MachO::LC_VERSION_MIN_WATCHOS) { in MachOObjectFile()
1468 if ((Err = checkVersCommand(*this, Load, I, &VersLoadCmd, in MachOObjectFile()
1471 } else if (Load.C.cmd == MachO::LC_NOTE) { in MachOObjectFile()
1472 if ((Err = checkNoteCommand(*this, Load, I, Elements))) in MachOObjectFile()
1474 } else if (Load.C.cmd == MachO::LC_BUILD_VERSION) { in MachOObjectFile()
1475 if ((Err = parseBuildVersionCommand(*this, Load, BuildTools, I))) in MachOObjectFile()
1477 } else if (Load.C.cmd == MachO::LC_RPATH) { in MachOObjectFile()
1478 if ((Err = checkRpathCommand(*this, Load, I))) 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()
1490 SourceLoadCmd = Load.Ptr; 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()
1501 EntryPointLoadCmd = Load.Ptr; 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()
1509 getStruct<MachO::encryption_info_command>(*this, Load.Ptr); in MachOObjectFile()
1510 if ((Err = checkEncryptCommand(*this, Load, I, E.cryptoff, E.cryptsize, 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()
1520 getStruct<MachO::encryption_info_command_64>(*this, Load.Ptr); in MachOObjectFile()
1521 if ((Err = checkEncryptCommand(*this, Load, I, E.cryptoff, E.cryptsize, in MachOObjectFile()
1524 } else if (Load.C.cmd == MachO::LC_LINKER_OPTION) { in MachOObjectFile()
1525 if ((Err = checkLinkerOptCommand(*this, Load, I))) 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()
1529 Err = malformedError("load command " + Twine(I) + in MachOObjectFile()
1534 getStruct<MachO::sub_framework_command>(*this, Load.Ptr); in MachOObjectFile()
1535 if ((Err = checkSubCommand(*this, Load, I, "LC_SUB_FRAMEWORK", 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()
1542 Err = malformedError("load command " + Twine(I) + in MachOObjectFile()
1547 getStruct<MachO::sub_umbrella_command>(*this, Load.Ptr); in MachOObjectFile()
1548 if ((Err = checkSubCommand(*this, Load, I, "LC_SUB_UMBRELLA", 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()
1555 Err = malformedError("load command " + Twine(I) + in MachOObjectFile()
1560 getStruct<MachO::sub_library_command>(*this, Load.Ptr); in MachOObjectFile()
1561 if ((Err = checkSubCommand(*this, Load, I, "LC_SUB_LIBRARY", 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()
1568 Err = malformedError("load command " + Twine(I) + in MachOObjectFile()
1573 getStruct<MachO::sub_client_command>(*this, Load.Ptr); in MachOObjectFile()
1574 if ((Err = checkSubCommand(*this, Load, I, "LC_SUB_CLIENT", in MachOObjectFile()
1578 } else if (Load.C.cmd == MachO::LC_ROUTINES) { in MachOObjectFile()
1579 if (Load.C.cmdsize != sizeof(MachO::routines_command)) { in MachOObjectFile()
1589 RoutinesLoadCmd = Load.Ptr; 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()
1601 RoutinesLoadCmd = Load.Ptr; in MachOObjectFile()
1602 } else if (Load.C.cmd == MachO::LC_UNIXTHREAD) { in MachOObjectFile()
1603 if ((Err = checkThreadCommand(*this, Load, I, "LC_UNIXTHREAD"))) in MachOObjectFile()
1609 UnixThreadLoadCmd = Load.Ptr; in MachOObjectFile()
1610 } else if (Load.C.cmd == MachO::LC_THREAD) { in MachOObjectFile()
1611 if ((Err = checkThreadCommand(*this, Load, I, "LC_THREAD"))) in MachOObjectFile()
1614 } else if (Load.C.cmd == MachO::LC_TWOLEVEL_HINTS) { in MachOObjectFile()
1615 if ((Err = checkTwoLevelHintsCommand(*this, Load, I, in MachOObjectFile()
1618 } else if (Load.C.cmd == MachO::LC_IDENT) { in MachOObjectFile()
1621 } else if (isLoadCommandObsolete(Load.C.cmd)) { in MachOObjectFile()
1622 Err = malformedError("load command " + Twine(I) + " for cmd value of: " + in MachOObjectFile()
1623 Twine(Load.C.cmd) + " is obsolete and not " in MachOObjectFile()
1627 // TODO: generate a error for unknown load commands by default. But still in MachOObjectFile()
1630 if (I < LoadCommandCount - 1) { in MachOObjectFile()
1631 if (auto LoadOrErr = getNextLoadCommandInfo(*this, I, Load)) in MachOObjectFile()
1632 Load = *LoadOrErr; in MachOObjectFile()
1641 Err = malformedError("contains LC_DYSYMTAB load command without a " in MachOObjectFile()
1642 "LC_SYMTAB load command"); in MachOObjectFile()
1651 Err = malformedError("ilocalsym in LC_DYSYMTAB load command " in MachOObjectFile()
1658 Err = malformedError("ilocalsym plus nlocalsym in LC_DYSYMTAB load " in MachOObjectFile()
1663 Err = malformedError("iextdefsym in LC_DYSYMTAB load command " in MachOObjectFile()
1671 "load command extends past the end of the symbol " in MachOObjectFile()
1676 Err = malformedError("iundefsym in LC_DYSYMTAB load command " in MachOObjectFile()
1683 Err = malformedError("iundefsym plus nundefsym in LC_DYSYMTAB load " in MachOObjectFile()
1691 Err = malformedError("no LC_ID_DYLIB load command in dynamic library " in MachOObjectFile()
1752 LibraryOrdinal - 1 >= Libraries.size() ) { in checkSymbolTable()
1860 if (Sec->isData() || Sec->isBSS()) in getSymbolType()
1918 DRI.d.a = index - 1; in getSymbolSection()
1929 return Entry.n_sect - 1; in getSymbolSectionID()
1952 // In the case if a malformed Mach-O file where the section offset is past in getSectionSize()
1975 if (FileSize - SectOffset < SectSize) in getSectionSize()
1976 return FileSize - SectOffset; in getSectionSize()
2021 DRI.d.a = SectionIndex - 1; in getSection()
2027 auto NameOrErr = Section.getName(); in getSection()
2080 auto SegmentOrErr = getStructOrErr<LoadCommandType>(Obj, LoadCmd.Ptr); in getSegmentContents()
2085 auto &Segment = SegmentOrErr.get(); in getSegmentContents()
2095 auto SegmentOrErr = getStructOrErr<LoadCommandType>(Obj, LoadCmd.Ptr); in getSegmentContents()
2100 auto &Segment = SegmentOrErr.get(); in getSegmentContents()
2108 for (auto LoadCmd : load_commands()) { in getSegmentContents()
2131 for (auto LoadCmd : load_commands()) { in getSegmentContents()
2280 unsigned Arch = this->getArch(); in getRelocationTypeName()
2459 Idx + Foo.size() + sizeof(".framework/")-1); in guessLibraryShortName()
2481 Idx + Foo.size() + sizeof(".framework/")-1); in guessLibraryShortName()
2498 Dot = Name.slice(a-2, a-1); in guessLibraryShortName()
2500 a = a - 2; in guessLibraryShortName()
2523 Dot = Lib.slice(Lib.size()-2, Lib.size()-1); in guessLibraryShortName()
2525 Lib = Lib.slice(0, Lib.size()-2); in guessLibraryShortName()
2540 Dot = Lib.slice(Lib.size()-2, Lib.size()-1); in guessLibraryShortName()
2542 Lib = Lib.slice(0, Lib.size()-2); in guessLibraryShortName()
2548 // for an undefined symbol in a linked Mach-O binary that was linked with the
2549 // normal two-level namespace default (that is MH_TWOLEVEL in the header).
2550 // It is passed the index (0 - based) of the library as translated from
2551 // GET_LIBRARY_ORDINAL (1 - based).
2561 auto CommandOrErr = in getLibraryShortNameByIndex()
2593 Sec.d.a = Rel->getRawDataRefImpl().d.a; in getRelocationRelocatedSection()
2641 uint64_t Index = (Symb.p - DRIstart.p) / SymbolTableEntrySize; in getSymbolIndex()
2665 return "Mach-O 32-bit i386"; in getFileFormatName()
2667 return "Mach-O arm"; in getFileFormatName()
2669 return "Mach-O arm64 (ILP32)"; in getFileFormatName()
2671 return "Mach-O 32-bit ppc"; in getFileFormatName()
2673 return "Mach-O 32-bit unknown"; in getFileFormatName()
2679 return "Mach-O 64-bit x86-64"; in getFileFormatName()
2681 return "Mach-O arm64"; in getFileFormatName()
2683 return "Mach-O 64-bit ppc64"; in getFileFormatName()
2685 return "Mach-O 64-bit unknown"; in getFileFormatName()
2724 return Triple("i386-apple-darwin"); in getArchTriple()
2733 return Triple("x86_64-apple-darwin"); in getArchTriple()
2737 return Triple("x86_64h-apple-darwin"); in getArchTriple()
2746 return Triple("armv4t-apple-darwin"); in getArchTriple()
2750 return Triple("armv5e-apple-darwin"); in getArchTriple()
2754 return Triple("xscale-apple-darwin"); in getArchTriple()
2758 return Triple("armv6-apple-darwin"); in getArchTriple()
2761 *McpuDefault = "cortex-m0"; in getArchTriple()
2764 return Triple("armv6m-apple-darwin"); in getArchTriple()
2768 return Triple("armv7-apple-darwin"); in getArchTriple()
2771 *McpuDefault = "cortex-m4"; in getArchTriple()
2774 return Triple("thumbv7em-apple-darwin"); in getArchTriple()
2777 *McpuDefault = "cortex-a7"; in getArchTriple()
2780 return Triple("armv7k-apple-darwin"); in getArchTriple()
2783 *McpuDefault = "cortex-m3"; in getArchTriple()
2786 return Triple("thumbv7m-apple-darwin"); in getArchTriple()
2789 *McpuDefault = "cortex-a7"; in getArchTriple()
2792 return Triple("armv7s-apple-darwin"); in getArchTriple()
2803 return Triple("arm64-apple-darwin"); in getArchTriple()
2806 *McpuDefault = "apple-a12"; in getArchTriple()
2809 return Triple("arm64e-apple-darwin"); in getArchTriple()
2820 return Triple("arm64_32-apple-darwin"); in getArchTriple()
2829 return Triple("ppc-apple-darwin"); in getArchTriple()
2838 return Triple("ppc64-apple-darwin"); in getArchTriple()
2852 auto validArchs = getValidArchs(); in isValidArch()
2989 return Stack.back().Start - Trie.begin(); in nodeOffset()
3044 *E = malformedError("dylib ordinal of re-export " + Twine(error) + in pushNode()
3053 if ((int64_t)State.Other > 0 && State.Other > O->getLibraryCount()) { in pushNode()
3056 Twine((int)O->getLibraryCount()) + in pushNode()
3068 *E = malformedError("import name of re-export in export trie data at " in pushNode()
3078 *E = malformedError("import name of re-export in export trie data at " in pushNode()
3111 Twine::utohexstr(State.Current - ExportStart) + in pushNode()
3143 *E = malformedError("edge sub-string in export trie data at node: 0x" + in pushDownUntilBottom()
3144 Twine::utohexstr(Top.Start - Trie.begin()) + in pushDownUntilBottom()
3155 Twine::utohexstr(Top.Start - Trie.begin())); in pushDownUntilBottom()
3162 Twine::utohexstr(Top.Start - Trie.begin()) + in pushDownUntilBottom()
3177 Twine::utohexstr(Stack.back().Start - Trie.begin())); in pushDownUntilBottom()
3184 // with the C++ iterator model. The solution is a non-recursive depth first
3203 Twine::utohexstr(Stack.back().Start - Trie.begin())); in moveNext()
3256 for (const auto &Command : O->load_commands()) { in MachOAbstractFixupEntry()
3258 MachO::segment_command SLC = O->getSegmentLoadCommand(Command); in MachOAbstractFixupEntry()
3264 MachO::segment_command_64 SLC_64 = O->getSegment64LoadCommand(Command); in MachOAbstractFixupEntry()
3280 return O->BindRebaseAddress(SegmentIndex, 0); in segmentAddress()
3284 return O->BindRebaseSegmentName(SegmentIndex); in segmentName()
3288 return O->BindRebaseSectionName(SegmentIndex, SegmentOffset); in sectionName()
3292 return O->BindRebaseAddress(SegmentIndex, SegmentOffset); in address()
3307 SegmentIndex = -1; in moveToFirst()
3326 if (auto FixupTargetsOrErr = O->getDyldChainedFixupTargets()) { in MachOChainedFixupEntry()
3333 if (auto SegmentsOrErr = O->getChainedFixupsSegments()) { in MachOChainedFixupEntry()
3334 Segments = std::move(SegmentsOrErr->second); in MachOChainedFixupEntry()
3342 auto FindInSegment = [this]() { in findNextPageWithFixups()
3353 SegmentData = O->getSegmentContents(Segments[InfoSegIndex].SegIdx); in findNextPageWithFixups()
3419 if (O->isLittleEndian() != sys::IsLittleEndianHost) in moveNext()
3422 // The bit extraction below assumes little-endian fixup entries. in moveNext()
3423 assert(O->isLittleEndian() && "big-endian object should have been rejected " in moveNext()
3425 auto Field = [this](uint8_t Right, uint8_t Count) { in moveNext()
3426 return (RawValue >> Right) & ((1ULL << Count) - 1); in moveNext()
3441 " has out-of range import ordinal " + in moveNext()
3501 --RemainingLoopCount; in moveNext()
3527 DEBUG_WITH_TYPE("mach-o-rebase", dbgs() << "REBASE_OPCODE_DONE\n"); in moveNext()
3534 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3539 "mach-o-rebase", in moveNext()
3549 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3553 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3558 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3563 "mach-o-rebase", in moveNext()
3574 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3578 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3583 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3587 DEBUG_WITH_TYPE("mach-o-rebase", in moveNext()
3594 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3599 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3603 DEBUG_WITH_TYPE("mach-o-rebase", in moveNext()
3613 RemainingLoopCount = ImmValue - 1; in moveNext()
3616 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3621 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3626 "mach-o-rebase", in moveNext()
3640 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3645 RemainingLoopCount = Count - 1; in moveNext()
3648 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3653 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3658 "mach-o-rebase", in moveNext()
3670 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3677 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3682 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3687 "mach-o-rebase", in moveNext()
3700 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3705 RemainingLoopCount = Count - 1; in moveNext()
3713 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3719 error = O->RebaseEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
3725 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3730 "mach-o-rebase", in moveNext()
3740 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3772 // For use with the SegIndex of a checked Mach-O Rebase entry
3775 return O->BindRebaseSegmentName(SegmentIndex); in segmentName()
3778 // For use with a SegIndex,SegOffset pair from a checked Mach-O Rebase entry
3781 return O->BindRebaseSectionName(SegmentIndex, SegmentOffset); in sectionName()
3784 // For use with a SegIndex,SegOffset pair from a checked Mach-O Rebase entry
3787 return O->BindRebaseAddress(SegmentIndex, SegmentOffset); in address()
3804 if (O->BindRebaseSectionTable == nullptr) in rebaseTable()
3805 O->BindRebaseSectionTable = std::make_unique<BindRebaseSegInfo>(O); in rebaseTable()
3840 --RemainingLoopCount; in moveNext()
3879 DEBUG_WITH_TYPE("mach-o-bind", dbgs() << "BIND_OPCODE_DONE\n"); in moveNext()
3885 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3891 if (ImmValue > O->getLibraryCount()) { in moveNext()
3895 Twine((int)O->getLibraryCount()) + in moveNext()
3897 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3902 "mach-o-bind", in moveNext()
3910 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3919 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3923 if (Ordinal > (int)O->getLibraryCount()) { in moveNext()
3927 Twine((int)O->getLibraryCount()) + in moveNext()
3929 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3934 "mach-o-bind", in moveNext()
3942 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3953 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3961 "mach-o-bind", in moveNext()
3975 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
3980 Ptr-SymStart); in moveNext()
3983 "mach-o-bind", in moveNext()
3996 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4001 "mach-o-bind", in moveNext()
4010 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4015 "mach-o-bind", in moveNext()
4025 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4029 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
4034 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4039 "mach-o-bind", in moveNext()
4050 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4054 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
4059 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4063 DEBUG_WITH_TYPE("mach-o-bind", in moveNext()
4071 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
4076 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4084 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4092 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4096 DEBUG_WITH_TYPE("mach-o-bind", in moveNext()
4105 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4109 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
4114 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4123 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4131 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4139 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4146 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset + in moveNext()
4152 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4158 "mach-o-bind", in moveNext()
4169 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4178 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4187 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4193 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset + in moveNext()
4198 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4202 DEBUG_WITH_TYPE("mach-o-bind", in moveNext()
4211 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4217 RemainingLoopCount = Count - 1; in moveNext()
4224 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4234 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4243 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4252 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4256 error = O->BindEntryCheckSegAndOffsets(SegmentIndex, SegmentOffset, in moveNext()
4262 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4267 "mach-o-bind", in moveNext()
4277 Twine::utohexstr(OpcodeStart - Opcodes.begin())); in moveNext()
4326 // For use with the SegIndex of a checked Mach-O Bind entry
4329 return O->BindRebaseSegmentName(SegmentIndex); in segmentName()
4332 // For use with a SegIndex,SegOffset pair from a checked Mach-O Bind entry
4335 return O->BindRebaseSectionName(SegmentIndex, SegmentOffset); in sectionName()
4338 // For use with a SegIndex,SegOffset pair from a checked Mach-O Bind entry
4341 return O->BindRebaseAddress(SegmentIndex, SegmentOffset); in address()
4357 uint32_t CurSegIndex = Obj->hasPageZeroSegment() ? 1 : 0; in BindRebaseSegInfo()
4360 for (const SectionRef &Section : Obj->sections()) { in BindRebaseSegInfo()
4370 Obj->getSectionFinalSegmentName(Section.getRawDataRefImpl()); in BindRebaseSegInfo()
4376 Info.SegmentIndex = CurSegIndex - 1; in BindRebaseSegInfo()
4377 Info.OffsetInSegment = Info.Address - CurSegAddress; in BindRebaseSegInfo()
4396 if (SegIndex == -1) in checkSegAndOffsets()
4422 // For use with the SegIndex of a checked Mach-O Bind or Rebase entry
4432 // For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase
4448 // For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase
4455 // For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase
4466 if (O->BindRebaseSectionTable == nullptr) in bindTable()
4467 O->BindRebaseSectionTable = std::make_unique<BindRebaseSegInfo>(O); in bindTable()
4531 return ArrayRef(Base->sectname); in getSectionRawName()
4539 return ArrayRef(Base->segname); in getSectionRawFinalSegmentName()
4617 DRI.d.a = SecNum - 1; in getAnyRelocationSection()
4801 auto P = reinterpret_cast<const MachO::any_relocation_info *>( in getRelocation()
4840 // If there is no SymtabLoadCmd return a load command with zero'ed fields. in getSymtabLoadCommand()
4855 // If there is no DysymtabLoadCmd return a load command with zero'ed fields. in getDysymtabLoadCommand()
4885 // If there is no DataInCodeLoadCmd return a load command with zero'ed fields. in getDataInCodeLoadCommand()
4899 // If there is no LinkOptHintsLoadCmd return a load command with zero'ed in getLinkOptHintsLoadCommand()
4913 auto DyldInfoOrErr = in getDyldInfoRebaseOpcodes()
4927 auto DyldInfoOrErr = in getDyldInfoBindOpcodes()
4941 auto DyldInfoOrErr = in getDyldInfoWeakBindOpcodes()
4955 auto DyldInfoOrErr = in getDyldInfoLazyBindOpcodes()
4969 auto DyldInfoOrErr = in getDyldInfoExportsTrie()
4981 // Load the dyld chained fixups load command. in getChainedFixupsLoadCommand()
4984 auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>( in getChainedFixupsLoadCommand()
4991 // If the load command is present but the data offset has been zeroed out, in getChainedFixupsLoadCommand()
5000 auto CFOrErr = getChainedFixupsLoadCommand(); in getChainedFixupsHeader()
5003 if (!CFOrErr->has_value()) in getChainedFixupsHeader()
5011 // Load the dyld chained fixups header. in getChainedFixupsHeader()
5013 auto CFHeaderOrErr = in getChainedFixupsHeader()
5030 // Load the image starts. in getChainedFixupsHeader()
5051 auto CFOrErr = getChainedFixupsLoadCommand(); in getChainedFixupsSegments()
5056 if (!CFOrErr->has_value()) in getChainedFixupsSegments()
5061 auto HeaderOrErr = getChainedFixupsHeader(); in getChainedFixupsSegments()
5064 if (!HeaderOrErr->has_value()) in getChainedFixupsSegments()
5070 auto ImageStartsOrErr = getStructOrErr<MachO::dyld_chained_starts_in_image>( in getChainedFixupsSegments()
5087 auto OffOrErr = in getChainedFixupsSegments()
5096 auto Fail = [&](Twine Message) { in getChainedFixupsSegments()
5105 auto SegOrErr = in getChainedFixupsSegments()
5122 // (DYLD_CHAINED_PTR_START_MULTI; 32-bit only). in getChainedFixupsSegments()
5153 for (auto &Element : RawValue) in getArray()
5160 auto CFOrErr = getChainedFixupsLoadCommand(); in getDyldChainedFixupTargets()
5165 if (!CFOrErr->has_value()) in getDyldChainedFixupTargets()
5170 auto CFHeaderOrErr = getChainedFixupsHeader(); in getDyldChainedFixupTargets()
5206 // for both LE and BE hosts, but we assume that the object is little-endian. in getDyldChainedFixupTargets()
5208 return createError("parsing big-endian chained fixups is not implemented"); in getDyldChainedFixupTargets()
5217 auto RawValue = getArray<uint32_t, 1>(*this, ImportPtr); in getDyldChainedFixupTargets()
5226 auto RawValue = getArray<uint32_t, 2>(*this, ImportPtr); in getDyldChainedFixupTargets()
5235 auto RawValue = getArray<uint64_t, 2>(*this, ImportPtr); in getDyldChainedFixupTargets()
5260 auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>( in getDyldExportsTrie()
5274 auto InfoOrErr = in getFunctionStarts()
5281 this->ReadULEB128s(Info.dataoff, FunctionStarts); in getFunctionStarts()
5362 auto EC = sys::fs::is_directory(BundlePath, IsDir); in findDsymObjectMembers()
5373 StringRef ObjectPath = Dir->path(); in findDsymObjectMembers()
5375 if (auto EC = sys::fs::status(ObjectPath, Status)) in findDsymObjectMembers()