15 #ifndef LLVM_OBJECT_MACHO_H
16 #define LLVM_OBJECT_MACHO_H
43 std::error_code
getOffset(uint32_t &Result)
const;
44 std::error_code
getLength(uint16_t &Result)
const;
45 std::error_code
getKind(uint16_t &Result)
const;
62 uint64_t
flags()
const;
64 uint64_t
other()
const;
76 uint64_t readULEB128(
const uint8_t *&p);
77 void pushDownUntilBottom();
78 void pushNode(uint64_t Offset);
82 NodeState(
const uint8_t *Ptr);
84 const uint8_t *Current;
88 const char *ImportName;
90 unsigned NextChildIndex;
91 unsigned ParentStringLength;
124 uint64_t readULEB128();
128 uint64_t SegmentOffset;
129 uint32_t SegmentIndex;
130 uint64_t RemainingLoopCount;
131 uint64_t AdvanceAmount;
154 uint32_t
flags()
const;
166 uint64_t readULEB128();
167 int64_t readSLEB128();
171 uint64_t SegmentOffset;
172 uint32_t SegmentIndex;
177 uint64_t RemainingLoopCount;
178 uint64_t AdvanceAmount;
197 std::error_code &EC);
262 unsigned getArch()
const override;
387 unsigned Index)
const;
389 unsigned Index)
const;
410 const char **McpuDefault =
nullptr);
412 const char **McpuDefault =
nullptr);
414 const char **McpuDefault,
Triple *ThumbTriple);
427 uint64_t getSymbolValueImpl(
DataRefImpl Symb)
const override;
434 SectionList Sections;
436 LibraryList Libraries;
439 mutable LibraryShortName LibrariesShortNames;
440 const char *SymtabLoadCmd;
441 const char *DysymtabLoadCmd;
442 const char *DataInCodeLoadCmd;
443 const char *LinkOptHintsLoadCmd;
444 const char *DyldInfoLoadCmd;
445 const char *UuidLoadCmd;
446 bool HasPageZeroSegment;
451 : DicePimpl(DiceP) , OwningObject(Owner) {}
454 return DicePimpl == Other.DicePimpl;
458 return DicePimpl < Other.DicePimpl;
464 DicePimpl.
p =
reinterpret_cast<uintptr_t
>(P + 1);
476 return std::error_code();
484 return std::error_code();
492 return std::error_code();
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
bool getPlainRelocationExternal(const MachO::any_relocation_info &RE) const
iterator_range< export_iterator > exports() const
For use iterating over all exported symbols.
Represents either an error or a value T.
load_command_iterator end_load_commands() const
std::error_code getIndirectName(DataRefImpl Symb, StringRef &Res) const
SymbolRef::Type getSymbolType(DataRefImpl Symb) const override
StringRef getStringTableData() const
std::error_code getKind(uint16_t &Result) const
basic_symbol_iterator symbol_begin_impl() const override
StringRef getFileFormatName() const override
MachO::linkedit_data_command getLinkOptHintsLoadCommand() const
uint64_t getRelocationOffset(DataRefImpl Rel) const override
bool isSectionVirtual(DataRefImpl Sec) const override
ArrayRef< char > getSectionRawFinalSegmentName(DataRefImpl Sec) const
ArrayRef< char > getSectionRawName(DataRefImpl Sec) const
MachO::data_in_code_entry getDataInCodeTableEntry(uint32_t DataOffset, unsigned Index) const
std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const override
void moveRelocationNext(DataRefImpl &Rel) const override
ExportEntry encapsulates the current-state-of-the-walk used when doing a non-recursive walk of the tr...
StringRef typeName() const
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
unsigned getAnyRelocationType(const MachO::any_relocation_info &RE) const
static Triple getHostArch()
uint32_t getScatteredRelocationType(const MachO::any_relocation_info &RE) const
uint8_t getRelocationLength(DataRefImpl Rel) const
This class is the base class for all object file types.
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
uint64_t getRelocationType(DataRefImpl Rel) const override
StringRef otherName() const
MachORebaseEntry encapsulates the current state in the decompression of rebasing opcodes.
uint64_t getSectionAlignment(DataRefImpl Sec) const override
ErrorOr< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
ArrayRef< uint8_t > getDyldInfoLazyBindOpcodes() const
load_command_iterator begin_load_commands() const
uint32_t getIndirectSymbolTableEntry(const MachO::dysymtab_command &DLC, unsigned Index) const
bool operator==(const MachORebaseEntry &) const
iterator_range< rebase_iterator > rebaseTable() const
For use iterating over all rebase table entries.
uint64_t getSectionAddress(DataRefImpl Sec) const override
content_iterator< ExportEntry > export_iterator
bool operator==(const ExportEntry &) const
ExportEntry(ArrayRef< uint8_t > Trie)
DataRefImpl getRawDataRefImpl() const
bool isSectionText(DataRefImpl Sec) const override
MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian, bool Is64Bits, std::error_code &EC)
std::error_code getOffset(uint32_t &Result) const
MachO::segment_command_64 getSegment64LoadCommand(const LoadCommandInfo &L) const
MachO::uuid_command getUuidCommand(const LoadCommandInfo &L) const
uint64_t segmentOffset() const
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
void ReadULEB128s(uint64_t Index, SmallVectorImpl< uint64_t > &Out) const
MachOBindEntry encapsulates the current state in the decompression of binding opcodes.
MachO::linker_option_command getLinkerOptionLoadCommand(const LoadCommandInfo &L) const
uint32_t nodeOffset() const
MachO::encryption_info_command_64 getEncryptionInfoCommand64(const LoadCommandInfo &L) const
dice_iterator end_dices() const
uint32_t getScatteredRelocationValue(const MachO::any_relocation_info &RE) const
MachO::dylib_command getDylibIDLoadCommand(const LoadCommandInfo &L) const
ErrorOr< StringRef > getSymbolName(DataRefImpl Symb) const override
static Triple getThumbArch(uint32_t CPUType, uint32_t CPUSubType, const char **McpuDefault=nullptr)
unsigned getArch() const override
MachO::routines_command getRoutinesCommand(const LoadCommandInfo &L) const
MachO::dylinker_command getDylinkerCommand(const LoadCommandInfo &L) const
const MachO::mach_header & getHeader() const
bool getScatteredRelocationScattered(const MachO::any_relocation_info &RE) const
MachO::section_64 getSection64(DataRefImpl DRI) const
MachO::entry_point_command getEntryPointCommand(const LoadCommandInfo &L) const
StringRef symbolName() const
MachO::routines_command_64 getRoutinesCommand64(const LoadCommandInfo &L) const
void moveSectionNext(DataRefImpl &Sec) const override
unsigned getSectionID(SectionRef Sec) const
const MachO::mach_header_64 & getHeader64() const
unsigned getAnyRelocationAddress(const MachO::any_relocation_info &RE) const
ArrayRef< uint8_t > getUuid() const
iterator_range< load_command_iterator > load_commands() const
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const
uint32_t segmentIndex() const
MachO::section getSection(DataRefImpl DRI) const
static bool is64Bit(const char *name)
MachO::segment_command getSegmentLoadCommand(const LoadCommandInfo &L) const
unsigned getAnyRelocationPCRel(const MachO::any_relocation_info &RE) const
ArrayRef< uint8_t > getDyldInfoRebaseOpcodes() const
MachO::source_version_command getSourceVersionCommand(const LoadCommandInfo &L) const
MachO::linkedit_data_command getDataInCodeLoadCommand() const
LoadCommandList::const_iterator load_command_iterator
bool operator==(const DiceRef &Other) const
DiceRef - This is a value type class that represents a single data in code entry in the table in a Ma...
MachORebaseEntry(ArrayRef< uint8_t > opcodes, bool is64Bit)
MachO::sub_framework_command getSubFrameworkCommand(const LoadCommandInfo &L) const
content_iterator< MachOBindEntry > bind_iterator
bool operator==(const MachOBindEntry &) const
StringRef typeName() const
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
MachO::thread_command getThreadCommand(const LoadCommandInfo &L) const
uint64_t getNValue(DataRefImpl Sym) const
Triple - Helper class for working with autoconf configuration names.
section_iterator getRelocationSection(DataRefImpl Rel) const
std::error_code getLibraryShortNameByIndex(unsigned Index, StringRef &) const
section_iterator getRelocationRelocatedSection(relocation_iterator Rel) const
bool hasPageZeroSegment() const
void moveSymbolNext(DataRefImpl &Symb) const override
unsigned getAnyRelocationLength(const MachO::any_relocation_info &RE) const
unsigned getSymbolSectionID(SymbolRef Symb) const
bool isSectionData(DataRefImpl Sec) const override
content_iterator< DiceRef > dice_iterator
StringRef getSectionFinalSegmentName(DataRefImpl Sec) const
std::error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const override
MachO::nlist_64 getSymbol64TableEntry(DataRefImpl DRI) const
ArrayRef< uint8_t > getDyldInfoExportsTrie() const
uint64_t segmentOffset() const
MachO::nlist getSymbolTableEntry(DataRefImpl DRI) const
std::error_code getLength(uint16_t &Result) const
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
uint32_t getSymbolFlags(DataRefImpl Symb) const override
MachO::sub_library_command getSubLibraryCommand(const LoadCommandInfo &L) const
SectionRef getAnyRelocationSection(const MachO::any_relocation_info &RE) const
A range adaptor for a pair of iterators.
MachO::encryption_info_command getEncryptionInfoCommand(const LoadCommandInfo &L) const
This is a value type class that represents a single symbol in the list of symbols in the object file...
bool operator<(const DiceRef &Other) const
MachO::mach_header_64 Header64
MachOBindEntry(ArrayRef< uint8_t > Opcodes, bool is64Bit, MachOBindEntry::Kind)
MachO::linkedit_data_command getLinkeditDataLoadCommand(const LoadCommandInfo &L) const
MachO::version_min_command getVersionMinLoadCommand(const LoadCommandInfo &L) const
static StringRef guessLibraryShortName(StringRef Name, bool &isFramework, StringRef &Suffix)
bool isSectionBSS(DataRefImpl Sec) const override
MachO::symtab_command getSymtabLoadCommand() const
std::error_code getSymbolSection(DataRefImpl Symb, section_iterator &Res) const override
basic_symbol_iterator getSymbolByIndex(unsigned Index) const
dice_iterator begin_dices() const
section_iterator section_begin() const override
static bool isValidArch(StringRef ArchFlag)
relocation_iterator section_rel_end(DataRefImpl Sec) const override
MachO::dysymtab_command getDysymtabLoadCommand() const
MachO::mach_header Header
MachO::rpath_command getRpathCommand(const LoadCommandInfo &L) const
MachO::data_in_code_entry getDice(DataRefImpl Rel) const
MachO::sub_umbrella_command getSubUmbrellaCommand(const LoadCommandInfo &L) const
unsigned getSectionType(SectionRef Sec) const
section_iterator section_end() const override
const ObjectFile * getObjectFile() const
iterator_range< bind_iterator > lazyBindTable() const
For use iterating over all lazy bind table entries.
ArrayRef< uint8_t > getDyldInfoWeakBindOpcodes() const
StringRef - Represent a constant reference to a string, i.e.
static bool classof(const Binary *v)
basic_symbol_iterator symbol_end_impl() const override
unsigned getPlainRelocationSymbolNum(const MachO::any_relocation_info &RE) const
MachO::dyld_info_command getDyldInfoLoadCommand(const LoadCommandInfo &L) const
bool isRelocationScattered(const MachO::any_relocation_info &RE) const
MachO::sub_client_command getSubClientCommand(const LoadCommandInfo &L) const
content_iterator< MachORebaseEntry > rebase_iterator
SmallVector< LoadCommandInfo, 4 > LoadCommandList
iterator_range< bind_iterator > bindTable() const
For use iterating over all bind table entries.
iterator_range< bind_iterator > weakBindTable() const
For use iterating over all lazy bind table entries.
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
uint32_t segmentIndex() const
This is a value type class that represents a single section in the list of sections in the object fil...
uint64_t getSectionSize(DataRefImpl Sec) const override
ArrayRef< uint8_t > getDyldInfoBindOpcodes() const