Lines Matching defs:MachOObjectFile

1 //===- MachOObjectFile.cpp - Mach-O object file binding -------------------===//
9 // This file defines the MachOObjectFile class, which binds the MachOObject
71 static T getStruct(const MachOObjectFile &O, const char *P) {
84 static Expected<T> getStructOrErr(const MachOObjectFile &O, const char *P) {
97 getSectionPtr(const MachOObjectFile &O, MachOObjectFile::LoadCommandInfo L,
111 static const char *getPtr(const MachOObjectFile &O, size_t Offset,
119 getSymbolTableEntryBase(const MachOObjectFile &O, DataRefImpl DRI) {
132 static unsigned getCPUType(const MachOObjectFile &O) {
136 static unsigned getCPUSubType(const MachOObjectFile &O) {
150 static bool getPlainRelocationPCRel(const MachOObjectFile &O,
162 static unsigned getPlainRelocationLength(const MachOObjectFile &O,
174 static unsigned getPlainRelocationType(const MachOObjectFile &O,
181 static uint32_t getSectionFlags(const MachOObjectFile &O,
191 static Expected<MachOObjectFile::LoadCommandInfo>
192 getLoadCommandInfo(const MachOObjectFile &Obj, const char *Ptr,
201 return MachOObjectFile::LoadCommandInfo({Ptr, *CmdOrErr});
206 static Expected<MachOObjectFile::LoadCommandInfo>
207 getFirstLoadCommandInfo(const MachOObjectFile &Obj) {
217 static Expected<MachOObjectFile::LoadCommandInfo>
218 getNextLoadCommandInfo(const MachOObjectFile &Obj, uint32_t LoadCommandIndex,
219 const MachOObjectFile::LoadCommandInfo &L) {
231 static void parseHeader(const MachOObjectFile &Obj, T &Header,
286 const MachOObjectFile &Obj, const MachOObjectFile::LoadCommandInfo &Load,
409 static Error checkSymtabCommand(const MachOObjectFile &Obj,
410 const MachOObjectFile::LoadCommandInfo &Load,
467 static Error checkDysymtabCommand(const MachOObjectFile &Obj,
468 const MachOObjectFile::LoadCommandInfo &Load,
600 static Error checkLinkeditDataCommand(const MachOObjectFile &Obj,
601 const MachOObjectFile::LoadCommandInfo &Load,
638 static Error checkDyldInfoCommand(const MachOObjectFile &Obj,
639 const MachOObjectFile::LoadCommandInfo &Load,
737 static Error checkDylibCommand(const MachOObjectFile &Obj,
738 const MachOObjectFile::LoadCommandInfo &Load,
769 static Error checkDylibIdCommand(const MachOObjectFile &Obj,
770 const MachOObjectFile::LoadCommandInfo &Load,
786 static Error checkDyldCommand(const MachOObjectFile &Obj,
787 const MachOObjectFile::LoadCommandInfo &Load,
818 static Error checkVersCommand(const MachOObjectFile &Obj,
819 const MachOObjectFile::LoadCommandInfo &Load,
833 static Error checkNoteCommand(const MachOObjectFile &Obj,
834 const MachOObjectFile::LoadCommandInfo &Load,
862 parseBuildVersionCommand(const MachOObjectFile &Obj,
863 const MachOObjectFile::LoadCommandInfo &Load,
885 static Error checkRpathCommand(const MachOObjectFile &Obj,
886 const MachOObjectFile::LoadCommandInfo &Load,
917 static Error checkEncryptCommand(const MachOObjectFile &Obj,
918 const MachOObjectFile::LoadCommandInfo &Load,
941 static Error checkLinkerOptCommand(const MachOObjectFile &Obj,
942 const MachOObjectFile::LoadCommandInfo &Load,
981 static Error checkSubCommand(const MachOObjectFile &Obj,
982 const MachOObjectFile::LoadCommandInfo &Load,
1008 static Error checkThreadCommand(const MachOObjectFile &Obj,
1009 const MachOObjectFile::LoadCommandInfo &Load,
1199 static Error checkTwoLevelHintsCommand(const MachOObjectFile &Obj,
1200 const MachOObjectFile::LoadCommandInfo
1252 Expected<std::unique_ptr<MachOObjectFile>>
1253 MachOObjectFile::create(MemoryBufferRef Object, bool IsLittleEndian,
1258 std::unique_ptr<MachOObjectFile> Obj(new MachOObjectFile(
1266 MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
1700 Error MachOObjectFile::checkSymbolTable() const {
1703 MachO::mach_header_64 H_64 = MachOObjectFile::getHeader64();
1706 MachO::mach_header H = MachOObjectFile::getHeader();
1767 void MachOObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
1774 Expected<StringRef> MachOObjectFile::getSymbolName(DataRefImpl Symb) const {
1789 unsigned MachOObjectFile::getSectionType(SectionRef Sec) const {
1795 uint64_t MachOObjectFile::getNValue(DataRefImpl Sym) const {
1806 std::error_code MachOObjectFile::getIndirectName(DataRefImpl Symb,
1820 uint64_t MachOObjectFile::getSymbolValueImpl(DataRefImpl Sym) const {
1824 Expected<uint64_t> MachOObjectFile::getSymbolAddress(DataRefImpl Sym) const {
1828 uint32_t MachOObjectFile::getSymbolAlignment(DataRefImpl DRI) const {
1837 uint64_t MachOObjectFile::getCommonSymbolSizeImpl(DataRefImpl DRI) const {
1842 MachOObjectFile::getSymbolType(DataRefImpl Symb) const {
1867 Expected<uint32_t> MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const {
1911 MachOObjectFile::getSymbolSection(DataRefImpl Symb) const {
1926 unsigned MachOObjectFile::getSymbolSectionID(SymbolRef Sym) const {
1932 void MachOObjectFile::moveSectionNext(DataRefImpl &Sec) const {
1936 Expected<StringRef> MachOObjectFile::getSectionName(DataRefImpl Sec) const {
1941 uint64_t MachOObjectFile::getSectionAddress(DataRefImpl Sec) const {
1947 uint64_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const {
1951 uint64_t MachOObjectFile::getSectionSize(DataRefImpl Sec) const {
1980 ArrayRef<uint8_t> MachOObjectFile::getSectionContents(uint32_t Offset,
1986 MachOObjectFile::getSectionContents(DataRefImpl Sec) const {
2003 uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
2016 Expected<SectionRef> MachOObjectFile::getSection(unsigned SectionIndex) const {
2025 Expected<SectionRef> MachOObjectFile::getSection(StringRef SectionName) const {
2036 bool MachOObjectFile::isSectionCompressed(DataRefImpl Sec) const {
2040 bool MachOObjectFile::isSectionText(DataRefImpl Sec) const {
2045 bool MachOObjectFile::isSectionData(DataRefImpl Sec) const {
2053 bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {
2061 bool MachOObjectFile::isDebugSection(DataRefImpl Sec) const {
2077 ArrayRef<uint8_t> getSegmentContents(const MachOObjectFile &Obj,
2078 MachOObjectFile::LoadCommandInfo LoadCmd,
2093 ArrayRef<uint8_t> getSegmentContents(const MachOObjectFile &Obj,
2094 MachOObjectFile::LoadCommandInfo LoadCmd) {
2107 MachOObjectFile::getSegmentContents(StringRef SegmentName) const {
2129 MachOObjectFile::getSegmentContents(size_t SegmentIndex) const {
2150 unsigned MachOObjectFile::getSectionID(SectionRef Sec) const {
2154 bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {
2161 bool MachOObjectFile::isSectionBitcode(DataRefImpl Sec) const {
2168 bool MachOObjectFile::isSectionStripped(DataRefImpl Sec) const {
2174 relocation_iterator MachOObjectFile::section_rel_begin(DataRefImpl Sec) const {
2182 MachOObjectFile::section_rel_end(DataRefImpl Sec) const {
2198 relocation_iterator MachOObjectFile::extrel_begin() const {
2206 relocation_iterator MachOObjectFile::extrel_end() const {
2215 relocation_iterator MachOObjectFile::locrel_begin() const {
2223 relocation_iterator MachOObjectFile::locrel_end() const {
2232 void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
2236 uint64_t MachOObjectFile::getRelocationOffset(DataRefImpl Rel) const {
2245 MachOObjectFile::getRelocationSymbol(DataRefImpl Rel) const {
2266 MachOObjectFile::getRelocationSection(DataRefImpl Rel) const {
2270 uint64_t MachOObjectFile::getRelocationType(DataRefImpl Rel) const {
2275 void MachOObjectFile::getRelocationTypeName(
2385 uint8_t MachOObjectFile::getRelocationLength(DataRefImpl Rel) const {
2426 StringRef MachOObjectFile::guessLibraryShortName(StringRef Name,
2552 std::error_code MachOObjectFile::getLibraryShortNameByIndex(unsigned Index,
2586 uint32_t MachOObjectFile::getLibraryCount() const {
2591 MachOObjectFile::getRelocationRelocatedSection(relocation_iterator Rel) const {
2597 basic_symbol_iterator MachOObjectFile::symbol_begin() const {
2606 basic_symbol_iterator MachOObjectFile::symbol_end() const {
2621 symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
2633 uint64_t MachOObjectFile::getSymbolIndex(DataRefImpl Symb) const {
2645 section_iterator MachOObjectFile::section_begin() const {
2650 section_iterator MachOObjectFile::section_end() const {
2656 uint8_t MachOObjectFile::getBytesInAddress() const {
2660 StringRef MachOObjectFile::getFileFormatName() const {
2689 Triple::ArchType MachOObjectFile::getArch(uint32_t CPUType, uint32_t CPUSubType) {
2710 Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
2847 Triple MachOObjectFile::getHostArch() {
2851 bool MachOObjectFile::isValidArch(StringRef ArchFlag) {
2856 ArrayRef<StringRef> MachOObjectFile::getValidArchs() {
2881 Triple::ArchType MachOObjectFile::getArch() const {
2885 Triple MachOObjectFile::getArchTriple(const char **McpuDefault) const {
2889 relocation_iterator MachOObjectFile::section_rel_begin(unsigned Index) const {
2895 relocation_iterator MachOObjectFile::section_rel_end(unsigned Index) const {
2901 dice_iterator MachOObjectFile::begin_dices() const {
2911 dice_iterator MachOObjectFile::end_dices() const {
2922 ExportEntry::ExportEntry(Error *E, const MachOObjectFile *O,
3228 MachOObjectFile::exports(Error &E, ArrayRef<uint8_t> Trie,
3229 const MachOObjectFile *O) {
3242 iterator_range<export_iterator> MachOObjectFile::exports(Error &Err) const {
3253 const MachOObjectFile *O)
3319 const MachOObjectFile *O,
3480 MachORebaseEntry::MachORebaseEntry(Error *E, const MachOObjectFile *O,
3802 MachOObjectFile::rebaseTable(Error &Err, MachOObjectFile *O,
3815 iterator_range<rebase_iterator> MachOObjectFile::rebaseTable(Error &Err) {
3819 MachOBindEntry::MachOBindEntry(Error *E, const MachOObjectFile *O,
4356 BindRebaseSegInfo::BindRebaseSegInfo(const object::MachOObjectFile *Obj) {
4463 MachOObjectFile::bindTable(Error &Err, MachOObjectFile *O,
4477 iterator_range<bind_iterator> MachOObjectFile::bindTable(Error &Err) {
4482 iterator_range<bind_iterator> MachOObjectFile::lazyBindTable(Error &Err) {
4487 iterator_range<bind_iterator> MachOObjectFile::weakBindTable(Error &Err) {
4492 iterator_range<fixup_iterator> MachOObjectFile::fixupTable(Error &Err) {
4505 MachOObjectFile::load_command_iterator
4506 MachOObjectFile::begin_load_commands() const {
4510 MachOObjectFile::load_command_iterator
4511 MachOObjectFile::end_load_commands() const {
4515 iterator_range<MachOObjectFile::load_command_iterator>
4516 MachOObjectFile::load_commands() const {
4521 MachOObjectFile::getSectionFinalSegmentName(DataRefImpl Sec) const {
4527 MachOObjectFile::getSectionRawName(DataRefImpl Sec) const {
4535 MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
4543 MachOObjectFile::isRelocationScattered(const MachO::any_relocation_info &RE)
4550 unsigned MachOObjectFile::getPlainRelocationSymbolNum(
4557 bool MachOObjectFile::getPlainRelocationExternal(
4564 bool MachOObjectFile::getScatteredRelocationScattered(
4569 uint32_t MachOObjectFile::getScatteredRelocationValue(
4574 uint32_t MachOObjectFile::getScatteredRelocationType(
4579 unsigned MachOObjectFile::getAnyRelocationAddress(
4586 unsigned MachOObjectFile::getAnyRelocationPCRel(
4593 unsigned MachOObjectFile::getAnyRelocationLength(
4601 MachOObjectFile::getAnyRelocationType(
4609 MachOObjectFile::getAnyRelocationSection(
4621 MachO::section MachOObjectFile::getSection(DataRefImpl DRI) const {
4626 MachO::section_64 MachOObjectFile::getSection64(DataRefImpl DRI) const {
4631 MachO::section MachOObjectFile::getSection(const LoadCommandInfo &L,
4637 MachO::section_64 MachOObjectFile::getSection64(const LoadCommandInfo &L,
4644 MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI) const {
4650 MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI) const {
4656 MachOObjectFile::getLinkeditDataLoadCommand(const LoadCommandInfo &L) const {
4661 MachOObjectFile::getSegmentLoadCommand(const LoadCommandInfo &L) const {
4666 MachOObjectFile::getSegment64LoadCommand(const LoadCommandInfo &L) const {
4671 MachOObjectFile::getLinkerOptionLoadCommand(const LoadCommandInfo &L) const {
4676 MachOObjectFile::getVersionMinLoadCommand(const LoadCommandInfo &L) const {
4681 MachOObjectFile::getNoteLoadCommand(const LoadCommandInfo &L) const {
4686 MachOObjectFile::getBuildVersionLoadCommand(const LoadCommandInfo &L) const {
4691 MachOObjectFile::getBuildToolVersion(unsigned index) const {
4696 MachOObjectFile::getDylibIDLoadCommand(const LoadCommandInfo &L) const {
4701 MachOObjectFile::getDyldInfoLoadCommand(const LoadCommandInfo &L) const {
4706 MachOObjectFile::getDylinkerCommand(const LoadCommandInfo &L) const {
4711 MachOObjectFile::getUuidCommand(const LoadCommandInfo &L) const {
4716 MachOObjectFile::getRpathCommand(const LoadCommandInfo &L) const {
4721 MachOObjectFile::getSourceVersionCommand(const LoadCommandInfo &L) const {
4726 MachOObjectFile::getEntryPointCommand(const LoadCommandInfo &L) const {
4731 MachOObjectFile::getEncryptionInfoCommand(const LoadCommandInfo &L) const {
4736 MachOObjectFile::getEncryptionInfoCommand64(const LoadCommandInfo &L) const {
4741 MachOObjectFile::getSubFrameworkCommand(const LoadCommandInfo &L) const {
4746 MachOObjectFile::getSubUmbrellaCommand(const LoadCommandInfo &L) const {
4751 MachOObjectFile::getSubLibraryCommand(const LoadCommandInfo &L) const {
4756 MachOObjectFile::getSubClientCommand(const LoadCommandInfo &L) const {
4761 MachOObjectFile::getRoutinesCommand(const LoadCommandInfo &L) const {
4766 MachOObjectFile::getRoutinesCommand64(const LoadCommandInfo &L) const {
4771 MachOObjectFile::getThreadCommand(const LoadCommandInfo &L) const {
4776 MachOObjectFile::getFilesetEntryLoadCommand(const LoadCommandInfo &L) const {
4781 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
4808 MachOObjectFile::getDice(DataRefImpl Rel) const {
4813 const MachO::mach_header &MachOObjectFile::getHeader() const {
4817 const MachO::mach_header_64 &MachOObjectFile::getHeader64() const {
4822 uint32_t MachOObjectFile::getIndirectSymbolTableEntry(
4830 MachOObjectFile::getDataInCodeTableEntry(uint32_t DataOffset,
4836 MachO::symtab_command MachOObjectFile::getSymtabLoadCommand() const {
4851 MachO::dysymtab_command MachOObjectFile::getDysymtabLoadCommand() const {
4881 MachOObjectFile::getDataInCodeLoadCommand() const {
4895 MachOObjectFile::getLinkOptHintsLoadCommand() const {
4909 ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
4923 ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const {
4937 ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
4951 ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
4965 ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const {
4980 MachOObjectFile::getChainedFixupsLoadCommand() const {
4999 MachOObjectFile::getChainedFixupsHeader() const {
5050 MachOObjectFile::getChainedFixupsSegments() const {
5149 static std::array<T, N> getArray(const MachOObjectFile &O, const void *Ptr) {
5159 MachOObjectFile::getDyldChainedFixupTargets() const {
5256 ArrayRef<uint8_t> MachOObjectFile::getDyldExportsTrie() const {
5270 SmallVector<uint64_t> MachOObjectFile::getFunctionStarts() const {
5285 ArrayRef<uint8_t> MachOObjectFile::getUuid() const {
5293 StringRef MachOObjectFile::getStringTableData() const {
5298 bool MachOObjectFile::is64Bit() const {
5303 void MachOObjectFile::ReadULEB128s(uint64_t Index,
5315 bool MachOObjectFile::isRelocatableObject() const {
5319 /// Create a MachOObjectFile instance from a given buffer.
5325 /// \returns A std::unique_ptr to a MachOObjectFile instance on success.
5326 Expected<std::unique_ptr<MachOObjectFile>> ObjectFile::createMachOObjectFile(
5331 return MachOObjectFile::create(Buffer, false, false, UniversalCputype,
5334 return MachOObjectFile::create(Buffer, true, false, UniversalCputype,
5337 return MachOObjectFile::create(Buffer, false, true, UniversalCputype,
5340 return MachOObjectFile::create(Buffer, true, true, UniversalCputype,
5346 StringRef MachOObjectFile::mapDebugSectionName(StringRef Name) const {
5353 MachOObjectFile::findDsymObjectMembers(StringRef Path) {
5396 MachOObjectFile::mapReflectionSectionNameToEnumValue(
5407 bool MachOObjectFile::isMachOPairedReloc(uint64_t RelocType, uint64_t Arch) {