LLVM 20.0.0git
|
#include "llvm/Object/MachO.h"
Classes | |
struct | LoadCommandInfo |
Public Types | |
using | LoadCommandList = SmallVector< LoadCommandInfo, 4 > |
using | load_command_iterator = LoadCommandList::const_iterator |
Public Types inherited from llvm::object::ObjectFile | |
using | symbol_iterator_range = iterator_range< symbol_iterator > |
using | section_iterator_range = iterator_range< section_iterator > |
Public Types inherited from llvm::object::SymbolicFile | |
using | basic_symbol_iterator_range = iterator_range< basic_symbol_iterator > |
Static Public Member Functions | |
static Expected< std::unique_ptr< MachOObjectFile > > | create (MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits, uint32_t UniversalCputype=0, uint32_t UniversalIndex=0, size_t MachOFilesetEntryOffset=0) |
static bool | isMachOPairedReloc (uint64_t RelocType, uint64_t Arch) |
static iterator_range< export_iterator > | exports (Error &Err, ArrayRef< uint8_t > Trie, const MachOObjectFile *O=nullptr) |
For use examining a trie not in a MachOObjectFile. | |
static iterator_range< rebase_iterator > | rebaseTable (Error &Err, MachOObjectFile *O, ArrayRef< uint8_t > Opcodes, bool is64) |
For use examining rebase opcodes in a MachOObjectFile. | |
static iterator_range< bind_iterator > | bindTable (Error &Err, MachOObjectFile *O, ArrayRef< uint8_t > Opcodes, bool is64, MachOBindEntry::Kind) |
For use examining bind opcodes in a MachOObjectFile. | |
static StringRef | guessLibraryShortName (StringRef Name, bool &isFramework, StringRef &Suffix) |
static Triple::ArchType | getArch (uint32_t CPUType, uint32_t CPUSubType) |
static Triple | getArchTriple (uint32_t CPUType, uint32_t CPUSubType, const char **McpuDefault=nullptr, const char **ArchFlag=nullptr) |
static bool | isValidArch (StringRef ArchFlag) |
static ArrayRef< StringRef > | getValidArchs () |
static Triple | getHostArch () |
static bool | classof (const Binary *v) |
static uint32_t | getVersionMinMajor (MachO::version_min_command &C, bool SDK) |
static uint32_t | getVersionMinMinor (MachO::version_min_command &C, bool SDK) |
static uint32_t | getVersionMinUpdate (MachO::version_min_command &C, bool SDK) |
static std::string | getBuildPlatform (uint32_t platform) |
static std::string | getBuildTool (uint32_t tools) |
static std::string | getVersionString (uint32_t version) |
static Expected< std::vector< std::string > > | findDsymObjectMembers (StringRef Path) |
If the input path is a .dSYM bundle (as created by the dsymutil tool), return the paths to the object files found in the bundle, otherwise return an empty vector. | |
Static Public Member Functions inherited from llvm::object::ObjectFile | |
static Expected< OwningBinary< ObjectFile > > | createObjectFile (StringRef ObjectPath) |
static Expected< std::unique_ptr< ObjectFile > > | createObjectFile (MemoryBufferRef Object, llvm::file_magic Type, bool InitContent=true) |
static Expected< std::unique_ptr< ObjectFile > > | createObjectFile (MemoryBufferRef Object) |
static bool | classof (const Binary *v) |
static Expected< std::unique_ptr< COFFObjectFile > > | createCOFFObjectFile (MemoryBufferRef Object) |
static Expected< std::unique_ptr< ObjectFile > > | createXCOFFObjectFile (MemoryBufferRef Object, unsigned FileType) |
static Expected< std::unique_ptr< ObjectFile > > | createELFObjectFile (MemoryBufferRef Object, bool InitContent=true) |
static Expected< std::unique_ptr< MachOObjectFile > > | createMachOObjectFile (MemoryBufferRef Object, uint32_t UniversalCputype=0, uint32_t UniversalIndex=0, size_t MachOFilesetEntryOffset=0) |
Create a MachOObjectFile instance from a given buffer. | |
static Expected< std::unique_ptr< ObjectFile > > | createGOFFObjectFile (MemoryBufferRef Object) |
static Expected< std::unique_ptr< WasmObjectFile > > | createWasmObjectFile (MemoryBufferRef Object) |
Static Public Member Functions inherited from llvm::object::SymbolicFile | |
static Expected< std::unique_ptr< SymbolicFile > > | createSymbolicFile (MemoryBufferRef Object, llvm::file_magic Type, LLVMContext *Context, bool InitContent=true) |
static Expected< std::unique_ptr< SymbolicFile > > | createSymbolicFile (MemoryBufferRef Object) |
static bool | classof (const Binary *v) |
static bool | isSymbolicFile (file_magic Type, const LLVMContext *Context) |
Static Public Member Functions inherited from llvm::object::Binary | |
static Error | checkOffset (MemoryBufferRef M, uintptr_t Addr, const uint64_t Size) |
dice_iterator MachOObjectFile::begin_dices | ( | ) | const |
Definition at line 2899 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, getDataInCodeLoadCommand(), getPtr(), and llvm::object::DataRefImpl::p.
MachOObjectFile::load_command_iterator MachOObjectFile::begin_load_commands | ( | ) | const |
Definition at line 4504 of file MachOObjectFile.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin().
Referenced by load_commands().
|
inline |
Definition at line 578 of file MachO.h.
Referenced by llvm::object::MachOBindEntry::moveNext().
|
inline |
For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase entry to get the address.
Definition at line 615 of file MachO.h.
Referenced by llvm::object::MachORebaseEntry::address(), llvm::object::MachOBindEntry::address(), llvm::object::MachOAbstractFixupEntry::address(), and llvm::object::MachOAbstractFixupEntry::segmentAddress().
|
inline |
For use with a SegIndex,SegOffset pair from a checked Mach-O Bind or Rebase entry to get the section name.
Definition at line 609 of file MachO.h.
Referenced by llvm::object::MachORebaseEntry::sectionName(), llvm::object::MachOBindEntry::sectionName(), and llvm::object::MachOAbstractFixupEntry::sectionName().
|
inline |
For use with the SegIndex of a checked Mach-O Bind or Rebase entry to get the segment name.
Definition at line 603 of file MachO.h.
Referenced by llvm::object::MachORebaseEntry::segmentName(), llvm::object::MachOBindEntry::segmentName(), and llvm::object::MachOAbstractFixupEntry::segmentName().
iterator_range< bind_iterator > MachOObjectFile::bindTable | ( | Error & | Err | ) |
For use iterating over all bind table entries.
Definition at line 4475 of file MachOObjectFile.cpp.
References bindTable(), getDyldInfoBindOpcodes(), is64Bit(), and llvm::object::MachOBindEntry::Regular.
Referenced by bindTable(), lazyBindTable(), and weakBindTable().
|
static |
For use examining bind opcodes in a MachOObjectFile.
Definition at line 4461 of file MachOObjectFile.cpp.
References llvm::make_range().
Error MachOObjectFile::checkSymbolTable | ( | ) | const |
Definition at line 1700 of file MachOObjectFile.cpp.
References llvm::MachO::DYNAMIC_LOOKUP_ORDINAL, llvm::MachO::EXECUTABLE_ORDINAL, llvm::MachO::mach_header_64::flags, llvm::MachO::GET_LIBRARY_ORDINAL(), getHeader(), getHeader64(), getSymbol64TableEntry(), getSymbolTableEntry(), getSymtabLoadCommand(), H, is64Bit(), malformedError(), llvm::MachO::MH_TWOLEVEL, llvm::MachO::nlist::n_desc, llvm::MachO::nlist_64::n_desc, llvm::MachO::N_INDR, llvm::MachO::N_PBUD, llvm::MachO::N_SECT, llvm::MachO::nlist::n_sect, llvm::MachO::nlist_64::n_sect, llvm::MachO::N_STAB, llvm::MachO::nlist::n_strx, llvm::MachO::nlist_64::n_strx, llvm::MachO::N_TYPE, llvm::MachO::nlist::n_type, llvm::MachO::nlist_64::n_type, llvm::MachO::N_UNDF, llvm::MachO::nlist::n_value, llvm::MachO::nlist_64::n_value, llvm::SmallVectorBase< Size_T >::size(), llvm::MachO::symtab_command::strsize, llvm::Error::success(), and llvm::object::ObjectFile::symbols().
|
static |
Definition at line 1253 of file MachOObjectFile.cpp.
References llvm::Error::success().
Referenced by llvm::object::ObjectFile::createMachOObjectFile().
dice_iterator MachOObjectFile::end_dices | ( | ) | const |
Definition at line 2909 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, llvm::MachO::linkedit_data_command::datasize, getDataInCodeLoadCommand(), getPtr(), llvm::Offset, and llvm::object::DataRefImpl::p.
MachOObjectFile::load_command_iterator MachOObjectFile::end_load_commands | ( | ) | const |
Definition at line 4509 of file MachOObjectFile.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::end().
Referenced by load_commands().
iterator_range< export_iterator > MachOObjectFile::exports | ( | Error & | Err | ) | const |
For use iterating over all exported symbols.
Definition at line 3240 of file MachOObjectFile.cpp.
References exports(), getDyldExportsTrie(), and getDyldInfoExportsTrie().
Referenced by exports(), and readSymbols().
|
static |
For use examining a trie not in a MachOObjectFile.
Definition at line 3226 of file MachOObjectFile.cpp.
References llvm::ArrayRef< T >::empty(), and llvm::make_range().
|
inline |
Definition at line 479 of file MachO.h.
References extrel_begin(), extrel_end(), and llvm::make_range().
relocation_iterator MachOObjectFile::extrel_begin | ( | ) | const |
Definition at line 2198 of file MachOObjectFile.cpp.
References llvm::object::ObjectFile::RelocationRef.
Referenced by external_relocations().
relocation_iterator MachOObjectFile::extrel_end | ( | ) | const |
Definition at line 2206 of file MachOObjectFile.cpp.
References getDysymtabLoadCommand(), llvm::MachO::dysymtab_command::nextrel, and llvm::object::ObjectFile::RelocationRef.
Referenced by external_relocations().
|
static |
If the input path is a .dSYM bundle (as created by the dsymutil tool), return the paths to the object files found in the bundle, otherwise return an empty vector.
If the path appears to be a .dSYM bundle but no objects were found or there was a filesystem error, then return an error.
Definition at line 5346 of file MachOObjectFile.cpp.
References llvm::sys::path::append(), llvm::createFileError(), llvm::createStringError(), llvm::errorCodeToError(), llvm::sys::path::extension(), llvm::sys::fs::is_directory(), llvm::no_such_file_or_directory, llvm::sys::fs::regular_file, llvm::sys::path::remove_dots(), llvm::sys::fs::status(), llvm::StringRef::str(), llvm::sys::fs::symlink_file, and llvm::sys::fs::type_unknown.
Referenced by llvm::MachO::DylibReader::accumulateSourceLocFromDSYM(), and llvm::InstrProfCorrelator::get().
iterator_range< fixup_iterator > MachOObjectFile::fixupTable | ( | Error & | Err | ) |
For iterating over all chained fixups.
Definition at line 4490 of file MachOObjectFile.cpp.
References llvm::make_range(), and llvm::object::MachOChainedFixupEntry::moveToEnd().
unsigned MachOObjectFile::getAnyRelocationAddress | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4577 of file MachOObjectFile.cpp.
References getPlainRelocationAddress(), getScatteredRelocationAddress(), and isRelocationScattered().
Referenced by getRelocationOffset().
unsigned MachOObjectFile::getAnyRelocationLength | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4591 of file MachOObjectFile.cpp.
References getPlainRelocationLength(), getScatteredRelocationLength(), and isRelocationScattered().
Referenced by llvm::RuntimeDyldMachO::getRelocationEntry(), getRelocationLength(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), and llvm::RuntimeDyldMachO::processScatteredVANILLA().
unsigned MachOObjectFile::getAnyRelocationPCRel | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4584 of file MachOObjectFile.cpp.
References getPlainRelocationPCRel(), getScatteredRelocationPCRel(), and isRelocationScattered().
Referenced by llvm::RuntimeDyldMachO::getRelocationEntry(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), and llvm::RuntimeDyldMachO::processScatteredVANILLA().
SectionRef MachOObjectFile::getAnyRelocationSection | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4607 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, getPlainRelocationExternal(), getPlainRelocationSymbolNum(), isRelocationScattered(), llvm::MachO::R_ABS, section_end(), and llvm::object::ObjectFile::SectionRef.
Referenced by getRelocationSection(), and llvm::RuntimeDyldMachO::getRelocationValueRef().
unsigned MachOObjectFile::getAnyRelocationType | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4599 of file MachOObjectFile.cpp.
References getPlainRelocationType(), getScatteredRelocationType(), and isRelocationScattered().
Referenced by extractSections(), llvm::RuntimeDyldMachO::getRelocationEntry(), getRelocationType(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), and llvm::RuntimeDyldMachO::processScatteredVANILLA().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2879 of file MachOObjectFile.cpp.
References getArch(), getCPUSubType(), and getCPUType().
Referenced by llvm::orc::checkMachORelocatableObject(), getArch(), and getRelocationTypeName().
|
static |
Definition at line 2687 of file MachOObjectFile.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_32, llvm::Triple::arm, llvm::MachO::CPU_TYPE_ARM, llvm::MachO::CPU_TYPE_ARM64, llvm::MachO::CPU_TYPE_ARM64_32, llvm::MachO::CPU_TYPE_I386, llvm::MachO::CPU_TYPE_POWERPC, llvm::MachO::CPU_TYPE_POWERPC64, llvm::MachO::CPU_TYPE_X86_64, llvm::Triple::ppc, llvm::Triple::ppc64, llvm::Triple::UnknownArch, llvm::Triple::x86, and llvm::Triple::x86_64.
Definition at line 2883 of file MachOObjectFile.cpp.
References llvm::MachO::mach_header::cpusubtype, llvm::MachO::mach_header::cputype, getArchTriple(), and Header.
Referenced by llvm::object::Slice::create(), llvm::object::MachOUniversalBinary::ObjectForArch::getArchFlagName(), getArchTriple(), and llvm::object::MachOUniversalBinary::ObjectForArch::getTriple().
|
static |
Definition at line 2708 of file MachOObjectFile.cpp.
References llvm::MachO::CPU_SUBTYPE_ARM64_32_V8, llvm::MachO::CPU_SUBTYPE_ARM64_ALL, llvm::MachO::CPU_SUBTYPE_ARM64E, llvm::MachO::CPU_SUBTYPE_ARM_V4T, llvm::MachO::CPU_SUBTYPE_ARM_V5TEJ, llvm::MachO::CPU_SUBTYPE_ARM_V6, llvm::MachO::CPU_SUBTYPE_ARM_V6M, llvm::MachO::CPU_SUBTYPE_ARM_V7, llvm::MachO::CPU_SUBTYPE_ARM_V7EM, llvm::MachO::CPU_SUBTYPE_ARM_V7K, llvm::MachO::CPU_SUBTYPE_ARM_V7M, llvm::MachO::CPU_SUBTYPE_ARM_V7S, llvm::MachO::CPU_SUBTYPE_ARM_XSCALE, llvm::MachO::CPU_SUBTYPE_I386_ALL, llvm::MachO::CPU_SUBTYPE_MASK, llvm::MachO::CPU_SUBTYPE_POWERPC_ALL, llvm::MachO::CPU_SUBTYPE_X86_64_ALL, llvm::MachO::CPU_SUBTYPE_X86_64_H, llvm::MachO::CPU_TYPE_ARM, llvm::MachO::CPU_TYPE_ARM64, llvm::MachO::CPU_TYPE_ARM64_32, llvm::MachO::CPU_TYPE_I386, llvm::MachO::CPU_TYPE_POWERPC, llvm::MachO::CPU_TYPE_POWERPC64, and llvm::MachO::CPU_TYPE_X86_64.
|
inlinestatic |
Definition at line 791 of file MachO.h.
References llvm::format_hex().
|
inlinestatic |
Definition at line 806 of file MachO.h.
References llvm::format_hex(), llvm::MachO::TOOL_CLANG, llvm::MachO::TOOL_LD, llvm::MachO::TOOL_LLD, and llvm::MachO::TOOL_SWIFT.
MachO::build_tool_version MachOObjectFile::getBuildToolVersion | ( | unsigned | index | ) | const |
Definition at line 4689 of file MachOObjectFile.cpp.
MachO::build_version_command MachOObjectFile::getBuildVersionLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4684 of file MachOObjectFile.cpp.
Referenced by constructTriples().
|
overridevirtual |
The number of bytes used to represent an address in this object file format.
Implements llvm::object::ObjectFile.
Definition at line 2654 of file MachOObjectFile.cpp.
References is64Bit().
Expected< std::optional< MachO::dyld_chained_fixups_header > > MachOObjectFile::getChainedFixupsHeader | ( | ) | const |
If the optional is std::nullopt, no header was found, but the object was well-formed.
Definition at line 4997 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, llvm::MachO::linkedit_data_command::datasize, llvm::MachO::dyld_chained_fixups_header::fixups_version, getChainedFixupsLoadCommand(), getPtr(), llvm::MachO::dyld_chained_fixups_header::imports_format, malformedError(), and llvm::MachO::dyld_chained_fixups_header::starts_offset.
Referenced by getChainedFixupsSegments(), and getDyldChainedFixupTargets().
Expected< std::optional< MachO::linkedit_data_command > > MachOObjectFile::getChainedFixupsLoadCommand | ( | ) | const |
Definition at line 4978 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff.
Referenced by getChainedFixupsHeader(), getChainedFixupsSegments(), and getDyldChainedFixupTargets().
Expected< std::pair< size_t, std::vector< ChainedFixupsSegment > > > MachOObjectFile::getChainedFixupsSegments | ( | ) | const |
Definition at line 5048 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, llvm::MachO::linkedit_data_command::datasize, Fail, getChainedFixupsHeader(), getChainedFixupsLoadCommand(), getPtr(), Header, I, llvm::object::Binary::isLittleEndian(), llvm::sys::IsLittleEndianHost, malformedError(), N, offsetof, llvm::MachO::dyld_chained_starts_in_segment::page_count, llvm::MachO::dyld_chained_starts_in_segment::pointer_format, llvm::MachO::dyld_chained_starts_in_image::seg_count, llvm::MachO::dyld_chained_starts_in_segment::size, and llvm::sys::swapByteOrder().
Referenced by llvm::object::MachOChainedFixupEntry::MachOChainedFixupEntry().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1837 of file MachOObjectFile.cpp.
References getNValue().
MachO::linkedit_data_command MachOObjectFile::getDataInCodeLoadCommand | ( | ) | const |
Definition at line 4879 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::cmd, llvm::MachO::linkedit_data_command::cmdsize, llvm::MachO::linkedit_data_command::dataoff, and llvm::MachO::linkedit_data_command::datasize.
Referenced by begin_dices(), and end_dices().
MachO::data_in_code_entry MachOObjectFile::getDataInCodeTableEntry | ( | uint32_t | DataOffset, |
unsigned | Index | ||
) | const |
Definition at line 4828 of file MachOObjectFile.cpp.
References getPtr(), and llvm::Offset.
MachO::data_in_code_entry MachOObjectFile::getDice | ( | DataRefImpl | Rel | ) | const |
Definition at line 4806 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::p, and P.
Referenced by llvm::object::DiceRef::getKind(), llvm::object::DiceRef::getLength(), and llvm::object::DiceRef::getOffset().
Expected< std::vector< ChainedFixupTarget > > MachOObjectFile::getDyldChainedFixupTargets | ( | ) | const |
Definition at line 5157 of file MachOObjectFile.cpp.
References llvm::object::createError(), llvm::MachO::linkedit_data_command::dataoff, llvm::MachO::linkedit_data_command::datasize, llvm::MachO::DYLD_CHAINED_IMPORT, llvm::MachO::DYLD_CHAINED_IMPORT_ADDEND, llvm::MachO::DYLD_CHAINED_IMPORT_ADDEND64, getChainedFixupsHeader(), getChainedFixupsLoadCommand(), getPtr(), Header, llvm::object::Binary::isLittleEndian(), llvm_unreachable, and malformedError().
Referenced by llvm::object::MachOChainedFixupEntry::MachOChainedFixupEntry().
Definition at line 5249 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, llvm::MachO::linkedit_data_command::datasize, getPtr(), and Ptr.
Referenced by exports().
Definition at line 4921 of file MachOObjectFile.cpp.
References llvm::MachO::dyld_info_command::bind_off, llvm::MachO::dyld_info_command::bind_size, getPtr(), and Ptr.
Referenced by bindTable().
Definition at line 4963 of file MachOObjectFile.cpp.
References llvm::MachO::dyld_info_command::export_off, llvm::MachO::dyld_info_command::export_size, getPtr(), and Ptr.
Referenced by exports().
Definition at line 4949 of file MachOObjectFile.cpp.
References getPtr(), llvm::MachO::dyld_info_command::lazy_bind_off, llvm::MachO::dyld_info_command::lazy_bind_size, and Ptr.
Referenced by lazyBindTable().
MachO::dyld_info_command MachOObjectFile::getDyldInfoLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4699 of file MachOObjectFile.cpp.
Definition at line 4907 of file MachOObjectFile.cpp.
References getPtr(), Ptr, llvm::MachO::dyld_info_command::rebase_off, and llvm::MachO::dyld_info_command::rebase_size.
Referenced by rebaseTable().
Definition at line 4935 of file MachOObjectFile.cpp.
References getPtr(), Ptr, llvm::MachO::dyld_info_command::weak_bind_off, and llvm::MachO::dyld_info_command::weak_bind_size.
Referenced by weakBindTable().
MachO::dylib_command MachOObjectFile::getDylibIDLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4694 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
MachO::dylinker_command MachOObjectFile::getDylinkerCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4704 of file MachOObjectFile.cpp.
MachO::dysymtab_command MachOObjectFile::getDysymtabLoadCommand | ( | ) | const |
Definition at line 4849 of file MachOObjectFile.cpp.
References llvm::MachO::dysymtab_command::cmd, llvm::MachO::dysymtab_command::cmdsize, llvm::MachO::dysymtab_command::extrefsymoff, llvm::MachO::dysymtab_command::extreloff, llvm::MachO::dysymtab_command::iextdefsym, llvm::MachO::dysymtab_command::ilocalsym, llvm::MachO::dysymtab_command::indirectsymoff, llvm::MachO::dysymtab_command::iundefsym, llvm::MachO::dysymtab_command::locreloff, llvm::MachO::dysymtab_command::modtaboff, llvm::MachO::dysymtab_command::nextdefsym, llvm::MachO::dysymtab_command::nextrefsyms, llvm::MachO::dysymtab_command::nextrel, llvm::MachO::dysymtab_command::nindirectsyms, llvm::MachO::dysymtab_command::nlocalsym, llvm::MachO::dysymtab_command::nlocrel, llvm::MachO::dysymtab_command::nmodtab, llvm::MachO::dysymtab_command::ntoc, llvm::MachO::dysymtab_command::nundefsym, and llvm::MachO::dysymtab_command::tocoff.
Referenced by extrel_end(), getRelocation(), locrel_end(), and llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection().
MachO::encryption_info_command MachOObjectFile::getEncryptionInfoCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4729 of file MachOObjectFile.cpp.
MachO::encryption_info_command_64 MachOObjectFile::getEncryptionInfoCommand64 | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4734 of file MachOObjectFile.cpp.
MachO::entry_point_command MachOObjectFile::getEntryPointCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4724 of file MachOObjectFile.cpp.
|
inlineoverridevirtual |
Implements llvm::object::ObjectFile.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2658 of file MachOObjectFile.cpp.
References llvm::MachO::CPU_TYPE_ARM, llvm::MachO::CPU_TYPE_ARM64, llvm::MachO::CPU_TYPE_ARM64_32, llvm::MachO::CPU_TYPE_I386, llvm::MachO::CPU_TYPE_POWERPC, llvm::MachO::CPU_TYPE_POWERPC64, llvm::MachO::CPU_TYPE_X86_64, getCPUType(), and is64Bit().
MachO::fileset_entry_command MachOObjectFile::getFilesetEntryLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4774 of file MachOObjectFile.cpp.
SmallVector< uint64_t > MachOObjectFile::getFunctionStarts | ( | ) | const |
Definition at line 5263 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::dataoff, Info, and ReadULEB128s().
const MachO::mach_header & MachOObjectFile::getHeader | ( | ) | const |
Definition at line 4811 of file MachOObjectFile.cpp.
References Header.
Referenced by checkDylibIdCommand(), checkSymbolTable(), extractSections(), getFirstLoadCommandInfo(), getNextLoadCommandInfo(), getRelocation(), getRelocationOffset(), isRelocatableObject(), parseSegmentLoadCommand(), and readMachOHeader().
const MachO::mach_header_64 & MachOObjectFile::getHeader64 | ( | ) | const |
Definition at line 4815 of file MachOObjectFile.cpp.
References assert(), Header64, and is64Bit().
Referenced by checkSymbolTable(), and llvm::jitlink::MachOLinkGraphBuilder::MachOLinkGraphBuilder().
|
static |
Definition at line 2845 of file MachOObjectFile.cpp.
References llvm::sys::getDefaultTargetTriple().
std::error_code MachOObjectFile::getIndirectName | ( | DataRefImpl | Symb, |
StringRef & | Res | ||
) | const |
Definition at line 1806 of file MachOObjectFile.cpp.
References getNValue(), getStringTableData(), getSymbolTableEntryBase(), llvm::MachO::N_INDR, llvm::MachO::N_TYPE, llvm::object::parse_failed, and llvm::StringTable::size().
uint32_t MachOObjectFile::getIndirectSymbolTableEntry | ( | const MachO::dysymtab_command & | DLC, |
unsigned | Index | ||
) | const |
Definition at line 4820 of file MachOObjectFile.cpp.
References getPtr(), and llvm::Offset.
Referenced by llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection().
uint32_t MachOObjectFile::getLibraryCount | ( | ) | const |
Definition at line 2584 of file MachOObjectFile.cpp.
References llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::object::MachOBindEntry::moveNext().
std::error_code MachOObjectFile::getLibraryShortNameByIndex | ( | unsigned | Index, |
StringRef & | Res | ||
) | const |
Definition at line 2550 of file MachOObjectFile.cpp.
References D, llvm::StringRef::empty(), guessLibraryShortName(), Name, P, llvm::object::parse_failed, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorBase< Size_T >::size().
MachO::linkedit_data_command MachOObjectFile::getLinkeditDataLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4654 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
MachO::linker_option_command MachOObjectFile::getLinkerOptionLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4669 of file MachOObjectFile.cpp.
MachO::linkedit_data_command MachOObjectFile::getLinkOptHintsLoadCommand | ( | ) | const |
Definition at line 4893 of file MachOObjectFile.cpp.
References llvm::MachO::linkedit_data_command::cmd, llvm::MachO::linkedit_data_command::cmdsize, llvm::MachO::linkedit_data_command::dataoff, and llvm::MachO::linkedit_data_command::datasize.
|
inline |
Definition at line 767 of file MachO.h.
Referenced by getFirstLoadCommandInfo(), getNextLoadCommandInfo(), and parseHeader().
MachO::note_command MachOObjectFile::getNoteLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4679 of file MachOObjectFile.cpp.
uint64_t MachOObjectFile::getNValue | ( | DataRefImpl | Sym | ) | const |
Definition at line 1795 of file MachOObjectFile.cpp.
References getSymbol64TableEntry(), getSymbolTableEntry(), is64Bit(), and Sym.
Referenced by getCommonSymbolSizeImpl(), getIndirectName(), and getSymbolFlags().
bool MachOObjectFile::getPlainRelocationExternal | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4555 of file MachOObjectFile.cpp.
References llvm::object::Binary::isLittleEndian(), and llvm::MachO::any_relocation_info::r_word1.
Referenced by extractSections(), getAnyRelocationSection(), getRelocationSymbol(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), and llvm::RuntimeDyldMachOX86_64::processRelocationRef().
unsigned MachOObjectFile::getPlainRelocationSymbolNum | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4548 of file MachOObjectFile.cpp.
References llvm::object::Binary::isLittleEndian(), and llvm::MachO::any_relocation_info::r_word1.
Referenced by getAnyRelocationSection(), getRelocationSymbol(), and llvm::RuntimeDyldMachOAArch64::processRelocationRef().
MachO::any_relocation_info MachOObjectFile::getRelocation | ( | DataRefImpl | Rel | ) | const |
Definition at line 4779 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::b, llvm::object::DataRefImpl::d, llvm::MachO::dysymtab_command::extreloff, getDysymtabLoadCommand(), getHeader(), getPtr(), getSection(), getSection64(), is64Bit(), llvm::MachO::dysymtab_command::locreloff, llvm::MachO::MH_OBJECT, llvm::Offset, P, llvm::MachO::section::reloff, and llvm::MachO::section_64::reloff.
Referenced by extractSections(), llvm::RuntimeDyldMachO::getRelocationEntry(), llvm::jitlink::MachOLinkGraphBuilder::getRelocationInfo(), getRelocationLength(), getRelocationOffset(), getRelocationSection(), getRelocationSymbol(), getRelocationType(), llvm::RuntimeDyldMachO::getRelocationValueRef(), isRelocScattered(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), and llvm::RuntimeDyldMachO::processScatteredVANILLA().
uint8_t MachOObjectFile::getRelocationLength | ( | DataRefImpl | Rel | ) | const |
Definition at line 2385 of file MachOObjectFile.cpp.
References getAnyRelocationLength(), and getRelocation().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2236 of file MachOObjectFile.cpp.
References assert(), getAnyRelocationAddress(), getHeader(), getRelocation(), llvm::MachO::MH_KEXT_BUNDLE, and llvm::MachO::MH_OBJECT.
section_iterator MachOObjectFile::getRelocationRelocatedSection | ( | relocation_iterator | Rel | ) | const |
Definition at line 2589 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, and llvm::object::ObjectFile::SectionRef.
section_iterator MachOObjectFile::getRelocationSection | ( | DataRefImpl | Rel | ) | const |
Definition at line 2266 of file MachOObjectFile.cpp.
References getAnyRelocationSection(), and getRelocation().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2245 of file MachOObjectFile.cpp.
References getPlainRelocationExternal(), getPlainRelocationSymbolNum(), getPtr(), getRelocation(), getSymtabLoadCommand(), is64Bit(), isRelocationScattered(), llvm::Offset, Sym, symbol_end(), llvm::object::ObjectFile::SymbolRef, llvm::XCOFF::SymbolTableEntrySize, and llvm::MachO::symtab_command::symoff.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2270 of file MachOObjectFile.cpp.
References getAnyRelocationType(), and getRelocation().
Referenced by getRelocationTypeName().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2275 of file MachOObjectFile.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_32, llvm::Triple::arm, llvm::StringRef::begin(), llvm::StringRef::end(), getArch(), getRelocationType(), llvm::Triple::ppc, llvm::Triple::UnknownArch, llvm::Triple::x86, and llvm::Triple::x86_64.
MachO::routines_command MachOObjectFile::getRoutinesCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4759 of file MachOObjectFile.cpp.
MachO::routines_command_64 MachOObjectFile::getRoutinesCommand64 | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4764 of file MachOObjectFile.cpp.
MachO::rpath_command MachOObjectFile::getRpathCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4714 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
bool MachOObjectFile::getScatteredRelocationScattered | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4562 of file MachOObjectFile.cpp.
References llvm::MachO::any_relocation_info::r_word0.
uint32_t MachOObjectFile::getScatteredRelocationType | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4572 of file MachOObjectFile.cpp.
References llvm::MachO::any_relocation_info::r_word0.
Referenced by getAnyRelocationType().
uint32_t MachOObjectFile::getScatteredRelocationValue | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4567 of file MachOObjectFile.cpp.
References llvm::MachO::any_relocation_info::r_word1.
Referenced by llvm::RuntimeDyldMachO::processScatteredVANILLA().
MachO::section MachOObjectFile::getSection | ( | const LoadCommandInfo & | L, |
unsigned | Index | ||
) | const |
Definition at line 4629 of file MachOObjectFile.cpp.
References getSectionPtr().
MachO::section MachOObjectFile::getSection | ( | DataRefImpl | DRI | ) | const |
Definition at line 4619 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, assert(), and llvm::object::DataRefImpl::d.
Expected< SectionRef > MachOObjectFile::getSection | ( | StringRef | SectionName | ) | const |
Definition at line 2025 of file MachOObjectFile.cpp.
References llvm::errorCodeToError(), llvm::object::parse_failed, and llvm::object::ObjectFile::sections().
Expected< SectionRef > MachOObjectFile::getSection | ( | unsigned | SectionIndex | ) | const |
Definition at line 2016 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, malformedError(), llvm::object::ObjectFile::SectionRef, and llvm::SmallVectorBase< Size_T >::size().
Referenced by extractSections(), getRelocation(), getSectionAddress(), getSectionAlignment(), getSectionContents(), getSectionSize(), isSectionStripped(), llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection(), and section_rel_end().
MachO::section_64 MachOObjectFile::getSection64 | ( | const LoadCommandInfo & | L, |
unsigned | Index | ||
) | const |
Definition at line 4635 of file MachOObjectFile.cpp.
References getSectionPtr().
MachO::section_64 MachOObjectFile::getSection64 | ( | DataRefImpl | DRI | ) | const |
Definition at line 4624 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, assert(), and llvm::object::DataRefImpl::d.
Referenced by getRelocation(), getSectionAddress(), getSectionAlignment(), getSectionContents(), getSectionSize(), isSectionStripped(), and section_rel_end().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1941 of file MachOObjectFile.cpp.
References llvm::MachO::section_64::addr, getSection(), getSection64(), and is64Bit().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2003 of file MachOObjectFile.cpp.
References llvm::MachO::section::align, llvm::MachO::section_64::align, getSection(), getSection64(), and is64Bit().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1986 of file MachOObjectFile.cpp.
References getSection(), getSection64(), getSectionContents(), is64Bit(), llvm::MachO::section::offset, llvm::MachO::section_64::offset, llvm::Offset, llvm::MachO::section::size, llvm::MachO::section_64::size, and Size.
Definition at line 1980 of file MachOObjectFile.cpp.
References llvm::object::Binary::getData(), llvm::Offset, Size, and substr().
Referenced by extractSections(), and getSectionContents().
StringRef MachOObjectFile::getSectionFinalSegmentName | ( | DataRefImpl | Sec | ) | const |
Definition at line 4519 of file MachOObjectFile.cpp.
References llvm::ArrayRef< T >::data(), getSectionRawFinalSegmentName(), and parseSegmentOrSectionName().
Referenced by llvm::object::BindRebaseSegInfo::BindRebaseSegInfo(), llvm::orc::getMachOObjectFileSymbolInfo(), and isSectionBitcode().
unsigned MachOObjectFile::getSectionID | ( | SectionRef | Sec | ) | const |
Definition at line 2150 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, and llvm::object::SectionRef::getRawDataRefImpl().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1947 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, and llvm::object::DataRefImpl::d.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1936 of file MachOObjectFile.cpp.
References llvm::ArrayRef< T >::data(), getSectionRawName(), and parseSegmentOrSectionName().
Referenced by llvm::orc::getMachOObjectFileSymbolInfo(), isDebugSection(), and isSectionBitcode().
ArrayRef< char > MachOObjectFile::getSectionRawFinalSegmentName | ( | DataRefImpl | Sec | ) | const |
Definition at line 4533 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, assert(), llvm::sampleprof::Base, and llvm::object::DataRefImpl::d.
Referenced by getSectionFinalSegmentName().
ArrayRef< char > MachOObjectFile::getSectionRawName | ( | DataRefImpl | Sec | ) | const |
Definition at line 4525 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, assert(), llvm::sampleprof::Base, and llvm::object::DataRefImpl::d.
Referenced by getSectionName().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1951 of file MachOObjectFile.cpp.
References llvm::MachO::section::flags, llvm::MachO::section_64::flags, llvm::object::Binary::getData(), getSection(), getSection64(), is64Bit(), llvm::MachO::section::offset, llvm::MachO::section_64::offset, llvm::MachO::S_GB_ZEROFILL, llvm::MachO::S_ZEROFILL, llvm::MachO::SECTION_TYPE, llvm::StringRef::size(), llvm::MachO::section::size, and llvm::MachO::section_64::size.
unsigned MachOObjectFile::getSectionType | ( | SectionRef | Sec | ) | const |
Definition at line 1789 of file MachOObjectFile.cpp.
References llvm::object::SectionRef::getRawDataRefImpl(), getSectionFlags(), and llvm::MachO::SECTION_TYPE.
Referenced by llvm::orc::getMachOObjectFileSymbolInfo().
MachO::segment_command_64 MachOObjectFile::getSegment64LoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4664 of file MachOObjectFile.cpp.
Referenced by llvm::object::MachOAbstractFixupEntry::MachOAbstractFixupEntry().
Definition at line 2129 of file MachOObjectFile.cpp.
References llvm::object::MachOObjectFile::LoadCommandInfo::C, llvm::MachO::load_command::cmd, Idx, and load_commands().
Return the raw contents of an entire segment.
Definition at line 2107 of file MachOObjectFile.cpp.
References llvm::object::MachOObjectFile::LoadCommandInfo::C, llvm::MachO::load_command::cmd, llvm::ArrayRef< T >::empty(), and load_commands().
MachO::segment_command MachOObjectFile::getSegmentLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4659 of file MachOObjectFile.cpp.
Referenced by llvm::object::MachOAbstractFixupEntry::MachOAbstractFixupEntry().
MachO::source_version_command MachOObjectFile::getSourceVersionCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4719 of file MachOObjectFile.cpp.
StringRef MachOObjectFile::getStringTableData | ( | ) | const |
Definition at line 5286 of file MachOObjectFile.cpp.
References llvm::object::Binary::getData(), getSymtabLoadCommand(), llvm::MachO::symtab_command::stroff, llvm::MachO::symtab_command::strsize, and llvm::StringRef::substr().
Referenced by getIndirectName(), and getSymbolName().
MachO::sub_client_command MachOObjectFile::getSubClientCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4754 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
MachO::sub_framework_command MachOObjectFile::getSubFrameworkCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4739 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
MachO::sub_library_command MachOObjectFile::getSubLibraryCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4749 of file MachOObjectFile.cpp.
MachO::sub_umbrella_command MachOObjectFile::getSubUmbrellaCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4744 of file MachOObjectFile.cpp.
MachO::nlist_64 MachOObjectFile::getSymbol64TableEntry | ( | DataRefImpl | DRI | ) | const |
Definition at line 4648 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::p, and P.
Referenced by checkSymbolTable(), and getNValue().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1824 of file MachOObjectFile.cpp.
References llvm::object::ObjectFile::getSymbolValue(), and Sym.
|
overridevirtual |
Reimplemented from llvm::object::ObjectFile.
Definition at line 1828 of file MachOObjectFile.cpp.
References llvm::cantFail(), llvm::MachO::GET_COMM_ALIGN(), getSymbolFlags(), getSymbolTableEntryBase(), and llvm::object::BasicSymbolRef::SF_Common.
symbol_iterator MachOObjectFile::getSymbolByIndex | ( | unsigned | Index | ) | const |
Definition at line 2619 of file MachOObjectFile.cpp.
References getPtr(), getSymtabLoadCommand(), is64Bit(), llvm::MachO::symtab_command::nsyms, llvm::object::DataRefImpl::p, llvm::report_fatal_error(), llvm::object::ObjectFile::SymbolRef, llvm::XCOFF::SymbolTableEntrySize, and llvm::MachO::symtab_command::symoff.
Referenced by llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection(), and symbol_begin().
|
overridevirtual |
Implements llvm::object::SymbolicFile.
Definition at line 1867 of file MachOObjectFile.cpp.
References getNValue(), getSymbolTableEntryBase(), llvm::MachO::N_ABS, llvm::MachO::N_ARM_THUMB_DEF, llvm::MachO::N_EXT, llvm::MachO::N_INDR, llvm::MachO::N_PEXT, llvm::MachO::N_STAB, llvm::MachO::N_TYPE, llvm::MachO::N_UNDF, llvm::MachO::N_WEAK_DEF, llvm::MachO::N_WEAK_REF, llvm::object::BasicSymbolRef::SF_Absolute, llvm::object::BasicSymbolRef::SF_Common, llvm::object::BasicSymbolRef::SF_Exported, llvm::object::BasicSymbolRef::SF_FormatSpecific, llvm::object::BasicSymbolRef::SF_Global, llvm::object::BasicSymbolRef::SF_Hidden, llvm::object::BasicSymbolRef::SF_Indirect, llvm::object::BasicSymbolRef::SF_None, llvm::object::BasicSymbolRef::SF_Thumb, llvm::object::BasicSymbolRef::SF_Undefined, and llvm::object::BasicSymbolRef::SF_Weak.
Referenced by getSymbolAlignment().
uint64_t MachOObjectFile::getSymbolIndex | ( | DataRefImpl | Symb | ) | const |
Definition at line 2631 of file MachOObjectFile.cpp.
References getPtr(), getSymtabLoadCommand(), is64Bit(), llvm::object::DataRefImpl::p, llvm::report_fatal_error(), llvm::XCOFF::SymbolTableEntrySize, and llvm::MachO::symtab_command::symoff.
Referenced by getSymbolName(), and getSymbolSection().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1774 of file MachOObjectFile.cpp.
References llvm::object::Binary::getData(), getStringTableData(), getSymbolIndex(), getSymbolTableEntryBase(), and malformedError().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1911 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, getSymbolIndex(), getSymbolTableEntryBase(), malformedError(), section_end(), llvm::object::ObjectFile::SectionRef, and llvm::SmallVectorBase< Size_T >::size().
Referenced by getSymbolType().
Definition at line 1926 of file MachOObjectFile.cpp.
References getSymbolTableEntryBase(), and Sym.
MachO::nlist MachOObjectFile::getSymbolTableEntry | ( | DataRefImpl | DRI | ) | const |
Definition at line 4642 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::p, and P.
Referenced by checkSymbolTable(), and getNValue().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1842 of file MachOObjectFile.cpp.
References getSymbolSection(), getSymbolTableEntryBase(), llvm::object::SectionRef::isBSS(), llvm::object::SectionRef::isData(), llvm::MachO::N_SECT, llvm::MachO::N_STAB, llvm::MachO::N_TYPE, llvm::MachO::N_UNDF, section_end(), llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_Debug, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Other, llvm::object::SymbolRef::ST_Unknown, and llvm::Expected< T >::takeError().
MachO::symtab_command MachOObjectFile::getSymtabLoadCommand | ( | ) | const |
Definition at line 4834 of file MachOObjectFile.cpp.
References llvm::MachO::symtab_command::cmd, llvm::MachO::symtab_command::cmdsize, llvm::MachO::symtab_command::nsyms, llvm::MachO::symtab_command::stroff, llvm::MachO::symtab_command::strsize, and llvm::MachO::symtab_command::symoff.
Referenced by checkSymbolTable(), getRelocationSymbol(), getStringTableData(), getSymbolByIndex(), getSymbolIndex(), symbol_begin(), and symbol_end().
MachO::thread_command MachOObjectFile::getThreadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4769 of file MachOObjectFile.cpp.
Definition at line 5278 of file MachOObjectFile.cpp.
MachO::uuid_command MachOObjectFile::getUuidCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4709 of file MachOObjectFile.cpp.
Referenced by readMachOHeader().
Definition at line 2854 of file MachOObjectFile.cpp.
Referenced by isValidArch().
MachO::version_min_command MachOObjectFile::getVersionMinLoadCommand | ( | const LoadCommandInfo & | L | ) | const |
Definition at line 4674 of file MachOObjectFile.cpp.
Referenced by constructTriples().
|
inlinestatic |
Definition at line 774 of file MachO.h.
References llvm::CallingConv::C.
|
inlinestatic |
Definition at line 780 of file MachO.h.
References llvm::CallingConv::C.
|
inlinestatic |
Definition at line 786 of file MachO.h.
References llvm::CallingConv::C.
|
inlinestatic |
Definition at line 821 of file MachO.h.
References llvm::Version.
|
static |
Definition at line 2426 of file MachOObjectFile.cpp.
References F, Idx, llvm::Lib, Name, llvm::StringRef::npos, llvm::StringRef::rfind(), llvm::StringRef::size(), llvm::StringRef::slice(), and llvm::StringRef::substr().
Referenced by getLibraryShortNameByIndex().
|
inline |
Definition at line 765 of file MachO.h.
Referenced by llvm::object::BindRebaseSegInfo::BindRebaseSegInfo().
|
overridevirtual |
Implements llvm::object::SymbolicFile.
Definition at line 5291 of file MachOObjectFile.cpp.
References llvm::object::Binary::getMachOType(), and llvm::object::Binary::getType().
Referenced by bindTable(), checkDysymtabCommand(), checkSymbolTable(), checkSymtabCommand(), getBytesInAddress(), getFileFormatName(), getFirstLoadCommandInfo(), getHeader64(), getNextLoadCommandInfo(), getNValue(), getRelocation(), getRelocationSymbol(), getSectionAddress(), getSectionAlignment(), getSectionContents(), getSectionSize(), getSymbolByIndex(), getSymbolIndex(), isSectionStripped(), lazyBindTable(), moveSymbolNext(), llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection(), rebaseTable(), section_rel_end(), symbol_end(), and weakBindTable().
|
overridevirtual |
Reimplemented from llvm::object::ObjectFile.
Definition at line 2061 of file MachOObjectFile.cpp.
References llvm::consumeError(), llvm::Expected< T >::get(), getSectionName(), and llvm::Expected< T >::takeError().
Definition at line 5400 of file MachOObjectFile.cpp.
References llvm::Triple::aarch64, llvm::Triple::arm, llvm::MachO::ARM64_RELOC_SUBTRACTOR, llvm::MachO::ARM_RELOC_HALF, llvm::MachO::ARM_RELOC_HALF_SECTDIFF, llvm::MachO::ARM_RELOC_LOCAL_SECTDIFF, llvm::MachO::ARM_RELOC_SECTDIFF, llvm::MachO::GENERIC_RELOC_LOCAL_SECTDIFF, llvm::MachO::GENERIC_RELOC_SECTDIFF, llvm::Triple::thumb, llvm::Triple::x86, llvm::Triple::x86_64, and llvm::MachO::X86_64_RELOC_SUBTRACTOR.
|
overridevirtual |
True if this is a relocatable object (.o/.obj).
Implements llvm::object::ObjectFile.
Definition at line 5308 of file MachOObjectFile.cpp.
References llvm::MachO::mach_header::filetype, getHeader(), and llvm::MachO::MH_OBJECT.
Referenced by llvm::jitlink::MachOLinkGraphBuilder::buildGraph().
bool MachOObjectFile::isRelocationScattered | ( | const MachO::any_relocation_info & | RE | ) | const |
Definition at line 4541 of file MachOObjectFile.cpp.
References llvm::MachO::CPU_TYPE_X86_64, getCPUType(), getPlainRelocationAddress(), and llvm::MachO::R_SCATTERED.
Referenced by extractSections(), getAnyRelocationAddress(), getAnyRelocationLength(), getAnyRelocationPCRel(), getAnyRelocationSection(), getAnyRelocationType(), getRelocationSymbol(), isRelocScattered(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldMachOI386::processRelocationRef(), and llvm::RuntimeDyldMachOX86_64::processRelocationRef().
|
overridevirtual |
Reimplemented from llvm::object::ObjectFile.
Definition at line 2161 of file MachOObjectFile.cpp.
References getSectionFinalSegmentName(), and getSectionName().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2053 of file MachOObjectFile.cpp.
References getSectionFlags(), llvm::MachO::S_ATTR_PURE_INSTRUCTIONS, llvm::MachO::S_GB_ZEROFILL, llvm::MachO::S_ZEROFILL, and llvm::MachO::SECTION_TYPE.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2036 of file MachOObjectFile.cpp.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2045 of file MachOObjectFile.cpp.
References getSectionFlags(), llvm::MachO::S_ATTR_PURE_INSTRUCTIONS, llvm::MachO::S_GB_ZEROFILL, llvm::MachO::S_ZEROFILL, and llvm::MachO::SECTION_TYPE.
|
overridevirtual |
When dsymutil generates the companion file, it strips all unnecessary sections (e.g.
everything in the _TEXT segment) by omitting their body and setting the offset in their corresponding load command to zero.
While the load command itself is valid, reading the section corresponds to reading the number of bytes specified in the load command, starting from offset 0 (i.e. the Mach-O header at the beginning of the file).
Reimplemented from llvm::object::ObjectFile.
Definition at line 2168 of file MachOObjectFile.cpp.
References getSection(), getSection64(), is64Bit(), and llvm::MachO::section_64::offset.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2040 of file MachOObjectFile.cpp.
References getSectionFlags(), and llvm::MachO::S_ATTR_PURE_INSTRUCTIONS.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2154 of file MachOObjectFile.cpp.
References getSectionFlags(), llvm::MachO::S_GB_ZEROFILL, llvm::MachO::S_ZEROFILL, and llvm::MachO::SECTION_TYPE.
Definition at line 2849 of file MachOObjectFile.cpp.
References getValidArchs(), and llvm::is_contained().
iterator_range< bind_iterator > MachOObjectFile::lazyBindTable | ( | Error & | Err | ) |
For use iterating over all lazy bind table entries.
Definition at line 4480 of file MachOObjectFile.cpp.
References bindTable(), getDyldInfoLazyBindOpcodes(), is64Bit(), and llvm::object::MachOBindEntry::Lazy.
iterator_range< MachOObjectFile::load_command_iterator > MachOObjectFile::load_commands | ( | ) | const |
Definition at line 4514 of file MachOObjectFile.cpp.
References begin_load_commands(), end_load_commands(), and llvm::make_range().
Referenced by constructTriples(), getSegmentContents(), llvm::object::MachOAbstractFixupEntry::MachOAbstractFixupEntry(), and readMachOHeader().
relocation_iterator MachOObjectFile::locrel_begin | ( | ) | const |
Definition at line 2215 of file MachOObjectFile.cpp.
References llvm::object::ObjectFile::RelocationRef.
relocation_iterator MachOObjectFile::locrel_end | ( | ) | const |
Definition at line 2223 of file MachOObjectFile.cpp.
References getDysymtabLoadCommand(), llvm::MachO::dysymtab_command::nlocrel, and llvm::object::ObjectFile::RelocationRef.
Maps a debug section name to a standard DWARF section name.
Reimplemented from llvm::object::ObjectFile.
Definition at line 5339 of file MachOObjectFile.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), and Name.
|
overridevirtual |
Reimplemented from llvm::object::ObjectFile.
Definition at line 5389 of file MachOObjectFile.cpp.
References llvm::StringSwitch< T, R >::Default(), and llvm::binaryformat::unknown.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2232 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::b, and llvm::object::DataRefImpl::d.
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 1932 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, and llvm::object::DataRefImpl::d.
|
overridevirtual |
Implements llvm::object::SymbolicFile.
Definition at line 1767 of file MachOObjectFile.cpp.
References is64Bit(), llvm::object::DataRefImpl::p, and llvm::XCOFF::SymbolTableEntrySize.
void MachOObjectFile::ReadULEB128s | ( | uint64_t | Index, |
SmallVectorImpl< uint64_t > & | Out | ||
) | const |
Definition at line 5296 of file MachOObjectFile.cpp.
References llvm::object::Binary::getData(), llvm::DataExtractor::getULEB128(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by getFunctionStarts().
|
inline |
Definition at line 592 of file MachO.h.
Referenced by llvm::object::MachORebaseEntry::moveNext().
iterator_range< rebase_iterator > MachOObjectFile::rebaseTable | ( | Error & | Err | ) |
For use iterating over all rebase table entries.
Definition at line 3813 of file MachOObjectFile.cpp.
References getDyldInfoRebaseOpcodes(), is64Bit(), and rebaseTable().
Referenced by rebaseTable().
|
static |
For use examining rebase opcodes in a MachOObjectFile.
Definition at line 3800 of file MachOObjectFile.cpp.
References llvm::make_range().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2643 of file MachOObjectFile.cpp.
References llvm::object::ObjectFile::SectionRef.
Referenced by llvm::RuntimeDyldMachO::getSectionByAddress().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2648 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, llvm::object::ObjectFile::SectionRef, and llvm::SmallVectorBase< Size_T >::size().
Referenced by getAnyRelocationSection(), llvm::RuntimeDyldMachO::getSectionByAddress(), getSymbolSection(), getSymbolType(), and llvm::RuntimeDyldMachO::processScatteredVANILLA().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2174 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, and llvm::object::ObjectFile::RelocationRef.
Referenced by extractSections(), and section_rel_begin().
relocation_iterator MachOObjectFile::section_rel_begin | ( | unsigned | Index | ) | const |
Definition at line 2887 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, and section_rel_begin().
|
overridevirtual |
Implements llvm::object::ObjectFile.
Definition at line 2182 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, getSection(), getSection64(), is64Bit(), llvm::MachO::section::nreloc, llvm::MachO::section_64::nreloc, and llvm::object::ObjectFile::RelocationRef.
Referenced by extractSections(), and section_rel_end().
relocation_iterator MachOObjectFile::section_rel_end | ( | unsigned | Index | ) | const |
Definition at line 2893 of file MachOObjectFile.cpp.
References llvm::object::DataRefImpl::a, llvm::object::DataRefImpl::d, and section_rel_end().
|
overridevirtual |
Implements llvm::object::SymbolicFile.
Definition at line 2595 of file MachOObjectFile.cpp.
References getSymbolByIndex(), getSymtabLoadCommand(), llvm::MachO::symtab_command::nsyms, and llvm::object::ObjectFile::SymbolRef.
|
overridevirtual |
Implements llvm::object::SymbolicFile.
Definition at line 2604 of file MachOObjectFile.cpp.
References getPtr(), getSymtabLoadCommand(), is64Bit(), llvm::MachO::symtab_command::nsyms, llvm::Offset, llvm::object::DataRefImpl::p, llvm::object::ObjectFile::SymbolRef, llvm::XCOFF::SymbolTableEntrySize, and llvm::MachO::symtab_command::symoff.
Referenced by getRelocationSymbol().
iterator_range< bind_iterator > MachOObjectFile::weakBindTable | ( | Error & | Err | ) |
For use iterating over all weak bind table entries.
Definition at line 4485 of file MachOObjectFile.cpp.
References bindTable(), getDyldInfoWeakBindOpcodes(), is64Bit(), and llvm::object::MachOBindEntry::Weak.
MachO::mach_header llvm::object::MachOObjectFile::Header |
Definition at line 850 of file MachO.h.
Referenced by getArchTriple(), getChainedFixupsSegments(), getDyldChainedFixupTargets(), and getHeader().
MachO::mach_header_64 llvm::object::MachOObjectFile::Header64 |
Definition at line 849 of file MachO.h.
Referenced by getHeader64().