14 #ifndef LLVM_OBJECT_OBJECTFILE_H
15 #define LLVM_OBJECT_OBJECTFILE_H
19 #include "llvm/Support/DataTypes.h"
42 template<
class content_type>
58 return Current == other.Current;
62 return !(*
this == other);
197 SF_Undefined = 1U << 0,
200 SF_Absolute = 1U << 3,
201 SF_ThreadLocal = 1U << 4,
203 SF_FormatSpecific = 1U << 31
267 virtual void anchor();
296 uint32_t &Res)
const = 0;
313 bool &Res)
const = 0;
319 bool &Result)
const = 0;
329 uint64_t &Res)
const =0;
331 uint64_t &Res)
const =0;
334 uint64_t &Res)
const = 0;
368 virtual unsigned getArch()
const = 0;
394 : SymbolPimpl(SymbolP)
395 , OwningObject(Owner) {}
398 return SymbolPimpl == Other.SymbolPimpl;
402 return SymbolPimpl < Other.SymbolPimpl;
453 : SectionPimpl(SectionP)
454 , OwningObject(Owner) {}
457 return SectionPimpl == Other.SectionPimpl;
461 return SectionPimpl < Other.SectionPimpl;
497 return OwningObject->
isSectionBSS(SectionPimpl, Result);
540 : RelocationPimpl(RelocationP)
541 , OwningObject(Owner) {}
544 return RelocationPimpl == Other.RelocationPimpl;
582 return RelocationPimpl;
591 : LibraryPimpl(LibraryP)
592 , OwningObject(Owner) {}
595 return LibraryPimpl == Other.LibraryPimpl;
599 return LibraryPimpl < Other.LibraryPimpl;
virtual symbol_iterator begin_dynamic_symbols() const =0
DataRefImpl getRawDataRefImpl() const
virtual error_code getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const =0
error_code getHidden(bool &Result) const
Indicates whether this relocation should hidden when listing relocations, usually because it is the t...
error_code isZeroInit(bool &Result) const
error_code getFileOffset(uint64_t &Result) const
static ObjectFile * createELFObjectFile(MemoryBuffer *Object)
virtual error_code getSymbolFlags(DataRefImpl Symb, uint32_t &Res) const =0
const char * getBufferStart() const
error_code getValue(uint64_t &Val) const
Get value of the symbol in the symbol table.
virtual error_code getRelocationNext(DataRefImpl Rel, RelocationRef &Res) const =0
const uint8_t * base() const
error_code getSize(uint64_t &Result) const
error_code getType(SymbolRef::Type &Result) const
error_code getNext(SymbolRef &Result) const
virtual error_code getSectionAlignment(DataRefImpl Sec, uint64_t &Res) const =0
error_code isVirtual(bool &Result) const
bool operator<(const DataRefImpl &a, const DataRefImpl &b)
error_code containsSymbol(SymbolRef S, bool &Result) const
error_code getAddress(uint64_t &Result) const
error_code getValueString(SmallVectorImpl< char > &Result) const
Get a string that represents the calculation of the value of this relocation.
DataRefImpl getRawDataRefImpl() const
section_iterator getRelocatedSection() const
virtual unsigned getArch() const =0
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const =0
virtual error_code getSymbolSection(DataRefImpl Symb, section_iterator &Res) const =0
virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb, bool &Result) const =0
virtual library_iterator end_libraries_needed() const =0
error_code getAlignment(uint64_t &Result) const
Get the alignment of this section as the actual value (not log 2).
virtual error_code getLibraryNext(DataRefImpl Lib, LibraryRef &Res) const =0
error_code getTypeName(SmallVectorImpl< char > &Result) const
Get a string that represents the type of this relocation.
virtual section_iterator end_sections() const =0
static ObjectFile * createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const =0
virtual error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const =0
error_code getSize(uint64_t &Result) const
virtual library_iterator begin_libraries_needed() const =0
error_code getFlags(uint32_t &Result) const
Get symbol flags (bitwise OR of SymbolRef::Flags)
error_code isBSS(bool &Result) const
error_code getName(StringRef &Result) const
virtual error_code getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
virtual error_code getSymbolValue(DataRefImpl Symb, uint64_t &Val) const =0
relocation_iterator end_relocations() const
bool operator!=(const content_iterator &other) const
error_code getPath(StringRef &Result) const
bool operator==(const SymbolRef &Other) const
virtual error_code getLibraryPath(DataRefImpl Lib, StringRef &Res) const =0
bool operator==(const LibraryRef &Other) const
error_code isText(bool &Result) const
virtual section_iterator begin_sections() const =0
content_iterator< SectionRef > section_iterator
int memcmp(const void *s1, const void *s2, size_t n);
content_iterator(content_type symb)
virtual uint8_t getBytesInAddress() const =0
The number of bytes used to represent an address in this object file format.
virtual error_code getSymbolFileOffset(DataRefImpl Symb, uint64_t &Res) const =0
bool operator==(const RelocationRef &Other) const
content_iterator< SymbolRef > symbol_iterator
error_code getAddress(uint64_t &Result) const
symbol_iterator getSymbol() const
ItTy next(ItTy it, Dist n)
virtual error_code getSectionNext(DataRefImpl Sec, SectionRef &Res) const =0
content_iterator< LibraryRef > library_iterator
virtual symbol_iterator end_symbols() const =0
error_code getNext(LibraryRef &Result) const
content_iterator< RelocationRef > relocation_iterator
virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const =0
error_code getAlignment(uint32_t &Result) const
Get the alignment of this symbol as the actual value (not log 2).
bool operator<(const LibraryRef &Other) const
error_code getSection(section_iterator &Result) const
Get section this symbol is defined in reference to. Result is end_sections() if it is undefined or is...
content_iterator & increment(error_code &err)
virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const =0
error_code isReadOnlyData(bool &Result) const
DataRefImpl getRawDataRefImpl() const
error_code getNext(SectionRef &Result) const
bool operator==(const DataRefImpl &a, const DataRefImpl &b)
virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const =0
virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const =0
virtual error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const =0
const uint64_t UnknownAddressOrSize
struct llvm::object::DataRefImpl::@77 d
virtual error_code isSectionText(DataRefImpl Sec, bool &Res) const =0
virtual symbol_iterator end_dynamic_symbols() const =0
#define LLVM_DELETED_FUNCTION
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const
virtual StringRef getLoadName() const =0
enum Flags LLVM_ENUM_INT_TYPE(unsigned)
static bool classof(const Binary *v)
error_code getAddress(uint64_t &Result) const
bool operator==(const content_iterator &other) const
virtual error_code getSectionAddress(DataRefImpl Sec, uint64_t &Res) const =0
virtual error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const =0
virtual error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const =0
virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const =0
error_code isRequiredForExecution(bool &Result) const
virtual error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const
virtual error_code getRelocationOffset(DataRefImpl Rel, uint64_t &Res) const =0
const content_type & operator*() const
virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const =0
bool operator==(const SectionRef &Other) const
virtual error_code getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const =0
bool operator<(const SectionRef &Other) const
error_code getContents(StringRef &Result) const
virtual error_code getRelocationValueString(DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
virtual symbol_iterator begin_symbols() const =0
const content_type * operator->() const
virtual error_code isSectionData(DataRefImpl Sec, bool &Res) const =0
virtual error_code getSectionName(DataRefImpl Sec, StringRef &Res) const =0
static ObjectFile * createCOFFObjectFile(MemoryBuffer *Object)
error_code isData(bool &Result) const
error_code getType(uint64_t &Result) const
relocation_iterator begin_relocations() const
const ObjectFile * getObjectFile() const
virtual error_code getRelocationHidden(DataRefImpl Rel, bool &Result) const
error_code getNext(RelocationRef &Result) const
virtual error_code getSymbolAddress(DataRefImpl Symb, uint64_t &Res) const =0
error_code getOffset(uint64_t &Result) const
virtual StringRef getFileFormatName() const =0
virtual error_code isSectionRequiredForExecution(DataRefImpl Sec, bool &Res) const =0
bool operator<(const SymbolRef &Other) const
virtual error_code getRelocationType(DataRefImpl Rel, uint64_t &Res) const =0
error_code getName(StringRef &Result) const
static ObjectFile * createMachOObjectFile(MemoryBuffer *Object)
DataRefImpl getRawDataRefImpl() const