Lines Matching refs:MachO
356 if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj)) in isSymbolList64Bit() local
357 return MachO->is64Bit(); in isSymbolList64Bit()
375 MachO::mach_header H; in darwinPrintSymbol()
376 MachO::mach_header_64 H_64; in darwinPrintSymbol()
377 uint32_t Filetype = MachO::MH_OBJECT; in darwinPrintSymbol()
384 MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj); in darwinPrintSymbol() local
388 NType |= MachO::N_EXT; in darwinPrintSymbol()
390 NType |= MachO::N_PEXT; in darwinPrintSymbol()
392 NType |= MachO::N_EXT | MachO::N_UNDF; in darwinPrintSymbol()
397 NType |= MachO::N_SECT; in darwinPrintSymbol()
406 NDesc |= MachO::N_WEAK_DEF; in darwinPrintSymbol()
409 if (MachO->is64Bit()) { in darwinPrintSymbol()
410 H_64 = MachO->MachOObjectFile::getHeader64(); in darwinPrintSymbol()
414 MachO::nlist_64 STE_64 = MachO->getSymbol64TableEntry(SymDRI); in darwinPrintSymbol()
428 H = MachO->MachOObjectFile::getHeader(); in darwinPrintSymbol()
432 MachO::nlist STE = MachO->getSymbolTableEntry(SymDRI); in darwinPrintSymbol()
453 if ((NType & MachO::N_TYPE) == MachO::N_INDR) { in darwinPrintSymbol()
458 if (MachO->getIndirectName(S.Sym.getRawDataRefImpl(), IndirectName)) in darwinPrintSymbol()
470 if ((NType & MachO::N_TYPE) == MachO::N_INDR) in darwinPrintSymbol()
472 if (Obj.isIR() && (NType & MachO::N_TYPE) == MachO::N_TYPE) in darwinPrintSymbol()
477 switch (NType & MachO::N_TYPE) { in darwinPrintSymbol()
478 case MachO::N_UNDF: in darwinPrintSymbol()
481 if (MachO::GET_COMM_ALIGN(NDesc) != 0) in darwinPrintSymbol()
482 outs() << "(alignment 2^" << (int)MachO::GET_COMM_ALIGN(NDesc) << ") "; in darwinPrintSymbol()
484 if ((NType & MachO::N_TYPE) == MachO::N_PBUD) in darwinPrintSymbol()
488 if ((NDesc & MachO::REFERENCE_TYPE) == in darwinPrintSymbol()
489 MachO::REFERENCE_FLAG_UNDEFINED_LAZY) in darwinPrintSymbol()
491 else if ((NDesc & MachO::REFERENCE_TYPE) == in darwinPrintSymbol()
492 MachO::REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) in darwinPrintSymbol()
494 else if ((NDesc & MachO::REFERENCE_TYPE) == in darwinPrintSymbol()
495 MachO::REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) in darwinPrintSymbol()
501 case MachO::N_ABS: in darwinPrintSymbol()
504 case MachO::N_INDR: in darwinPrintSymbol()
507 case MachO::N_SECT: { in darwinPrintSymbol()
524 MachO->getSymbolSection(S.Sym.getRawDataRefImpl()); in darwinPrintSymbol()
531 if (Sec == MachO->section_end()) { in darwinPrintSymbol()
540 if (Expected<StringRef> NameOrErr = MachO->getSectionName(Ref)) in darwinPrintSymbol()
542 StringRef SegmentName = MachO->getSectionFinalSegmentName(Ref); in darwinPrintSymbol()
551 if (NType & MachO::N_EXT) { in darwinPrintSymbol()
552 if (NDesc & MachO::REFERENCED_DYNAMICALLY) in darwinPrintSymbol()
554 if (NType & MachO::N_PEXT) { in darwinPrintSymbol()
555 if ((NDesc & MachO::N_WEAK_DEF) == MachO::N_WEAK_DEF) in darwinPrintSymbol()
560 if ((NDesc & MachO::N_WEAK_REF) == MachO::N_WEAK_REF || in darwinPrintSymbol()
561 (NDesc & MachO::N_WEAK_DEF) == MachO::N_WEAK_DEF) { in darwinPrintSymbol()
562 if ((NDesc & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF)) == in darwinPrintSymbol()
563 (MachO::N_WEAK_REF | MachO::N_WEAK_DEF)) in darwinPrintSymbol()
571 if (NType & MachO::N_PEXT) in darwinPrintSymbol()
577 if (Filetype == MachO::MH_OBJECT) { in darwinPrintSymbol()
578 if (NDesc & MachO::N_NO_DEAD_STRIP) in darwinPrintSymbol()
580 if ((NType & MachO::N_TYPE) != MachO::N_UNDF && in darwinPrintSymbol()
581 NDesc & MachO::N_SYMBOL_RESOLVER) in darwinPrintSymbol()
583 if ((NType & MachO::N_TYPE) != MachO::N_UNDF && NDesc & MachO::N_ALT_ENTRY) in darwinPrintSymbol()
585 if ((NType & MachO::N_TYPE) != MachO::N_UNDF && NDesc & MachO::N_COLD_FUNC) in darwinPrintSymbol()
589 if ((NDesc & MachO::N_ARM_THUMB_DEF) == MachO::N_ARM_THUMB_DEF) in darwinPrintSymbol()
592 if ((NType & MachO::N_TYPE) == MachO::N_INDR) { in darwinPrintSymbol()
595 if (MachO) { in darwinPrintSymbol()
597 if (MachO->getIndirectName(S.Sym.getRawDataRefImpl(), IndirectName)) in darwinPrintSymbol()
608 if ((Flags & MachO::MH_TWOLEVEL) == MachO::MH_TWOLEVEL && in darwinPrintSymbol()
609 (((NType & MachO::N_TYPE) == MachO::N_UNDF && NValue == 0) || in darwinPrintSymbol()
610 (NType & MachO::N_TYPE) == MachO::N_PBUD)) { in darwinPrintSymbol()
611 uint32_t LibraryOrdinal = MachO::GET_LIBRARY_ORDINAL(NDesc); in darwinPrintSymbol()
613 if (LibraryOrdinal == MachO::EXECUTABLE_ORDINAL) in darwinPrintSymbol()
615 else if (LibraryOrdinal == MachO::DYNAMIC_LOOKUP_ORDINAL) in darwinPrintSymbol()
619 if (!MachO || in darwinPrintSymbol()
620 MachO->getLibraryShortNameByIndex(LibraryOrdinal - 1, LibraryName)) in darwinPrintSymbol()
637 {MachO::N_GSYM, "GSYM"},
638 {MachO::N_FNAME, "FNAME"},
639 {MachO::N_FUN, "FUN"},
640 {MachO::N_STSYM, "STSYM"},
641 {MachO::N_LCSYM, "LCSYM"},
642 {MachO::N_BNSYM, "BNSYM"},
643 {MachO::N_PC, "PC"},
644 {MachO::N_AST, "AST"},
645 {MachO::N_OPT, "OPT"},
646 {MachO::N_RSYM, "RSYM"},
647 {MachO::N_SLINE, "SLINE"},
648 {MachO::N_ENSYM, "ENSYM"},
649 {MachO::N_SSYM, "SSYM"},
650 {MachO::N_SO, "SO"},
651 {MachO::N_OSO, "OSO"},
652 {MachO::N_LSYM, "LSYM"},
653 {MachO::N_BINCL, "BINCL"},
654 {MachO::N_SOL, "SOL"},
655 {MachO::N_PARAMS, "PARAM"},
656 {MachO::N_VERSION, "VERS"},
657 {MachO::N_OLEVEL, "OLEV"},
658 {MachO::N_PSYM, "PSYM"},
659 {MachO::N_EINCL, "EINCL"},
660 {MachO::N_ENTRY, "ENTRY"},
661 {MachO::N_LBRAC, "LBRAC"},
662 {MachO::N_EXCL, "EXCL"},
663 {MachO::N_RBRAC, "RBRAC"},
664 {MachO::N_BCOMM, "BCOMM"},
665 {MachO::N_ECOMM, "ECOMM"},
666 {MachO::N_ECOML, "ECOML"},
667 {MachO::N_LENG, "LENG"},
679 static void darwinPrintStab(MachOObjectFile *MachO, const NMSymbol &S) { in darwinPrintStab() argument
680 MachO::nlist_64 STE_64; in darwinPrintStab()
681 MachO::nlist STE; in darwinPrintStab()
686 if (MachO->is64Bit()) { in darwinPrintStab()
687 STE_64 = MachO->getSymbol64TableEntry(SymDRI); in darwinPrintStab()
692 STE = MachO->getSymbolTableEntry(SymDRI); in darwinPrintStab()
819 MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj); in sortAndPrintSymbolList() local
821 if (Optional<std::string> Opt = demangle(S.Name, MachO)) in sortAndPrintSymbolList()
845 (UndefinedOnly && MachO && OutputFormat != darwin)) && in sortAndPrintSymbolList()
869 else if (MachO && S.TypeChar == 'I') in sortAndPrintSymbolList()
882 if ((OutputFormat == darwin || FormatMachOasHex) && (MachO || Obj.isIR())) { in sortAndPrintSymbolList()
887 << (MachO ? "0" : SymbolSizeStr) << "\n"; in sortAndPrintSymbolList()
888 } else if (OutputFormat == bsd || (OutputFormat == darwin && !MachO)) { in sortAndPrintSymbolList()
894 if (S.TypeChar == '-' && MachO) in sortAndPrintSymbolList()
895 darwinPrintStab(MachO, S); in sortAndPrintSymbolList()
897 if (S.TypeChar == 'I' && MachO) { in sortAndPrintSymbolList()
901 if (MachO->getIndirectName(S.Sym.getRawDataRefImpl(), IndirectName)) in sortAndPrintSymbolList()
1035 if (NType & MachO::N_STAB) in getSymbolNMTypeChar()
1038 switch (NType & MachO::N_TYPE) { in getSymbolNMTypeChar()
1039 case MachO::N_ABS: in getSymbolNMTypeChar()
1041 case MachO::N_INDR: in getSymbolNMTypeChar()
1043 case MachO::N_SECT: { in getSymbolNMTypeChar()
1057 if (Obj.is64Bit() && Obj.getHeader64().filetype == MachO::MH_KEXT_BUNDLE && in getSymbolNMTypeChar()
1166 else if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj)) in getNMSectionTagAndName() local
1167 Ret = getSymbolNMTypeChar(*MachO, I); in getNMSectionTagAndName()
1216 MachO::nlist_64 STE = Obj.getSymbol64TableEntry(Symb); in getNsectInMachO()
1217 return (STE.n_type & MachO::N_TYPE) == MachO::N_SECT ? STE.n_sect : 0; in getNsectInMachO()
1219 MachO::nlist STE = Obj.getSymbolTableEntry(Symb); in getNsectInMachO()
1220 return (STE.n_type & MachO::N_TYPE) == MachO::N_SECT ? STE.n_sect : 0; in getNsectInMachO()
1240 MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj); local
1241 if (!SegSect.empty() && MachO) {
1242 Nsect = getNsectForSegSect(MachO);
1247 if (!(MachO && DyldInfoOnly)) {
1261 if (Nsect && Nsect != getNsectInMachO(*MachO, Sym))
1280 if (MachO) {
1316 if (MachO && !NoDyldInfo) {
1317 MachO::mach_header H;
1318 MachO::mach_header_64 H_64;
1320 if (MachO->is64Bit()) {
1321 H_64 = MachO->MachOObjectFile::getHeader64();
1324 H = MachO->MachOObjectFile::getHeader();
1328 for (const auto &Command : MachO->load_commands()) {
1329 if (Command.C.cmd == MachO::LC_SEGMENT) {
1330 MachO::segment_command Seg = MachO->getSegmentLoadCommand(Command);
1335 } else if (Command.C.cmd == MachO::LC_SEGMENT_64) {
1336 MachO::segment_command_64 Seg = MachO->getSegment64LoadCommand(Command);
1344 HFlags & MachO::MH_NLIST_OUTOFSYNC_WITH_DYLDINFO) {
1347 for (const llvm::object::ExportEntry &Entry : MachO->exports(Err)) {
1376 bool Abs = ((EFlags & MachO::EXPORT_SYMBOL_FLAGS_KIND_MASK) ==
1377 MachO::EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE);
1379 MachO::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER);
1380 ReExport = (EFlags & MachO::EXPORT_SYMBOL_FLAGS_REEXPORT);
1381 bool WeakDef = (EFlags & MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION);
1383 S.NDesc |= MachO::N_WEAK_DEF;
1385 S.NType = MachO::N_EXT | MachO::N_ABS;
1388 S.NType = MachO::N_EXT | MachO::N_INDR;
1391 S.NType = MachO::N_EXT | MachO::N_SECT;
1395 !MachO->is64Bit() && H.cputype == MachO::CPU_TYPE_ARM){
1397 S.NDesc |= MachO::N_ARM_THUMB_DEF;
1404 for (const SectionRef &Section : MachO->sections()) {
1412 SegmentName = MachO->getSectionFinalSegmentName(
1421 S.NDesc |= MachO::REFERENCED_DYNAMICALLY;
1468 U.NType = MachO::N_EXT | MachO::N_UNDF;
1473 MachO::SET_LIBRARY_ORDINAL(U.NDesc, Entry.other());
1488 error(std::move(Err), MachO->getFileName());
1508 for (const llvm::object::MachOBindEntry &Entry : MachO->bindTable(BErr)) {
1529 B.NType = MachO::N_EXT | MachO::N_UNDF;
1532 MachO::SET_LIBRARY_ORDINAL(B.NDesc, Entry.ordinal());
1542 error(std::move(BErr), MachO->getFileName());
1563 MachO->lazyBindTable(LErr)) {
1588 L.NType = MachO::N_EXT | MachO::N_UNDF;
1592 L.NDesc = MachO::REFERENCE_FLAG_UNDEFINED_LAZY;
1593 MachO::SET_LIBRARY_ORDINAL(L.NDesc, Entry.ordinal());
1602 error(std::move(LErr), MachO->getFileName());
1624 MachO->weakBindTable(WErr)) {
1628 Entry.flags() & MachO::BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION) {
1650 W.NType = MachO::N_EXT | MachO::N_UNDF;
1655 W.NDesc = MachO::N_WEAK_DEF;
1667 SymbolList[J].NDesc |= MachO::N_WEAK_DEF;
1671 error(std::move(WErr), MachO->getFileName());
1691 for (const auto &Command : MachO->load_commands()) {
1692 if (Command.C.cmd == MachO::LC_FUNCTION_STARTS) {
1695 MachO::linkedit_data_command LLC =
1696 MachO->getLinkeditDataLoadCommand(Command);
1698 MachO->ReadULEB128s(LLC.dataoff, FoundFns);
1699 } else if (Command.C.cmd == MachO::LC_MAIN) {
1700 MachO::entry_point_command LCmain =
1701 MachO->getEntryPointCommand(Command);
1725 F.NType = MachO::N_SECT;
1729 for (const SectionRef &Section : MachO->sections()) {
1735 SegmentName = MachO->getSectionFinalSegmentName(
1795 auto *MachO = dyn_cast<MachOObjectFile>(O); in checkMachOAndArchFlags() local
1797 if (!MachO || ArchAll || ArchFlags.empty()) in checkMachOAndArchFlags()
1800 MachO::mach_header H; in checkMachOAndArchFlags()
1801 MachO::mach_header_64 H_64; in checkMachOAndArchFlags()
1804 if (MachO->is64Bit()) { in checkMachOAndArchFlags()
1805 H_64 = MachO->MachOObjectFile::getHeader64(); in checkMachOAndArchFlags()
1809 H = MachO->MachOObjectFile::getHeader(); in checkMachOAndArchFlags()