LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
llvm::object::ObjectFile Class Reference

#include <ObjectFile.h>

Inheritance diagram for llvm::object::ObjectFile:
Inheritance graph
[legend]
Collaboration diagram for llvm::object::ObjectFile:
Collaboration graph
[legend]

List of all members.

Public Types

typedef iterator_range
< symbol_iterator
symbol_iterator_range
typedef iterator_range
< section_iterator
section_iterator_range

Public Member Functions

symbol_iterator_range symbols () const
virtual section_iterator section_begin () const =0
virtual section_iterator section_end () const =0
section_iterator_range sections () const
virtual uint8_t getBytesInAddress () const =0
 The number of bytes used to represent an address in this object file format.
virtual StringRef getFileFormatName () const =0
virtual unsigned getArch () const =0
virtual std::error_code getPlatformFlags (unsigned &Result) const
 Returns platform-specific object flags, if any.
virtual bool isRelocatableObject () const =0
 True if this is a relocatable object (.o/.obj).

Static Public Member Functions

static ErrorOr< OwningBinary
< ObjectFile > > 
createObjectFile (StringRef ObjectPath)
 Create ObjectFile from path.
static ErrorOr
< std::unique_ptr< ObjectFile > > 
createObjectFile (MemoryBufferRef Object, sys::fs::file_magic Type)
static ErrorOr
< std::unique_ptr< ObjectFile > > 
createObjectFile (MemoryBufferRef Object)
static bool classof (const Binary *v)
static ErrorOr
< std::unique_ptr
< COFFObjectFile > > 
createCOFFObjectFile (MemoryBufferRef Object)
static ErrorOr
< std::unique_ptr< ObjectFile > > 
createELFObjectFile (MemoryBufferRef Object)
static ErrorOr
< std::unique_ptr
< MachOObjectFile > > 
createMachOObjectFile (MemoryBufferRef Object)

Protected Member Functions

 ObjectFile (unsigned int Type, MemoryBufferRef Source)
const uint8_t * base () const
virtual std::error_code getSymbolName (DataRefImpl Symb, StringRef &Res) const =0
std::error_code printSymbolName (raw_ostream &OS, DataRefImpl Symb) const override
virtual std::error_code getSymbolAddress (DataRefImpl Symb, uint64_t &Res) const =0
virtual std::error_code getSymbolAlignment (DataRefImpl Symb, uint32_t &Res) const
virtual std::error_code getSymbolSize (DataRefImpl Symb, uint64_t &Res) const =0
virtual std::error_code getSymbolType (DataRefImpl Symb, SymbolRef::Type &Res) const =0
virtual std::error_code getSymbolSection (DataRefImpl Symb, section_iterator &Res) const =0
virtual std::error_code getSymbolOther (DataRefImpl Symb, uint8_t &Res) const
virtual void moveSectionNext (DataRefImpl &Sec) const =0
virtual std::error_code getSectionName (DataRefImpl Sec, StringRef &Res) const =0
virtual std::error_code getSectionAddress (DataRefImpl Sec, uint64_t &Res) const =0
virtual std::error_code getSectionSize (DataRefImpl Sec, uint64_t &Res) const =0
virtual std::error_code getSectionContents (DataRefImpl Sec, StringRef &Res) const =0
virtual std::error_code getSectionAlignment (DataRefImpl Sec, uint64_t &Res) const =0
virtual std::error_code isSectionText (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionData (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionBSS (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionRequiredForExecution (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionVirtual (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionZeroInit (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code isSectionReadOnlyData (DataRefImpl Sec, bool &Res) const =0
virtual std::error_code sectionContainsSymbol (DataRefImpl Sec, DataRefImpl Symb, bool &Result) const =0
virtual relocation_iterator section_rel_begin (DataRefImpl Sec) const =0
virtual relocation_iterator section_rel_end (DataRefImpl Sec) const =0
virtual section_iterator getRelocatedSection (DataRefImpl Sec) const
virtual void moveRelocationNext (DataRefImpl &Rel) const =0
virtual std::error_code getRelocationAddress (DataRefImpl Rel, uint64_t &Res) const =0
virtual std::error_code getRelocationOffset (DataRefImpl Rel, uint64_t &Res) const =0
virtual symbol_iterator getRelocationSymbol (DataRefImpl Rel) const =0
virtual std::error_code getRelocationType (DataRefImpl Rel, uint64_t &Res) const =0
virtual std::error_code getRelocationTypeName (DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
virtual std::error_code getRelocationValueString (DataRefImpl Rel, SmallVectorImpl< char > &Result) const =0
virtual std::error_code getRelocationHidden (DataRefImpl Rel, bool &Result) const

Friends

class SymbolRef
class SectionRef
class RelocationRef

Detailed Description

ObjectFile - This class is the base class for all object file types. Concrete instances of this object are created by createObjectFile, which figures out which type to create.

Definition at line 184 of file ObjectFile.h.


Member Typedef Documentation

Definition at line 287 of file ObjectFile.h.

Definition at line 279 of file ObjectFile.h.


Constructor & Destructor Documentation

ObjectFile::ObjectFile ( unsigned int  Type,
MemoryBufferRef  Source 
) [protected]

Definition at line 28 of file ObjectFile.cpp.


Member Function Documentation

const uint8_t* llvm::object::ObjectFile::base ( ) const [inline, protected]
static bool llvm::object::ObjectFile::classof ( const Binary v) [inline, static]
ErrorOr< std::unique_ptr< COFFObjectFile > > ObjectFile::createCOFFObjectFile ( MemoryBufferRef  Object) [static]

Definition at line 1126 of file COFFObjectFile.cpp.

References llvm::MipsISD::Ret.

Referenced by createObjectFile().

ErrorOr< std::unique_ptr< ObjectFile > > llvm::ObjectFile::createELFObjectFile ( MemoryBufferRef  Object) [static]
ErrorOr< std::unique_ptr< MachOObjectFile > > ObjectFile::createMachOObjectFile ( MemoryBufferRef  Object) [static]

Create ObjectFile from path.

Returns:
Pointer to ObjectFile subclass to handle this type of object.
Parameters:
ObjectPathThe path to the object file. ObjectPath.isObject must return true.

Definition at line 88 of file ObjectFile.cpp.

References llvm::ErrorOr< T >::get(), llvm::ErrorOr< T >::getError(), and llvm::MemoryBuffer::getFile().

Referenced by createObjectFile(), llvm::object::SymbolicFile::createSymbolicFile(), LLVMCreateObjectFile(), llvm::coverage::ObjectFileCoverageMappingReader::ObjectFileCoverageMappingReader(), and llvm::ObjectImageCommon::ObjectImageCommon().

ErrorOr< std::unique_ptr< ObjectFile > > ObjectFile::createObjectFile ( MemoryBufferRef  Object,
sys::fs::file_magic  Type 
) [static]
static ErrorOr<std::unique_ptr<ObjectFile> > llvm::object::ObjectFile::createObjectFile ( MemoryBufferRef  Object) [inline, static]

Definition at line 318 of file ObjectFile.h.

References createObjectFile(), and llvm::sys::fs::file_magic::unknown.

virtual unsigned llvm::object::ObjectFile::getArch ( ) const [pure virtual]
virtual uint8_t llvm::object::ObjectFile::getBytesInAddress ( ) const [pure virtual]

The number of bytes used to represent an address in this object file format.

Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, and llvm::object::ELFObjectFile< ELFT >.

Referenced by llvm::coverage::ObjectFileCoverageMappingReader::readHeader().

virtual StringRef llvm::object::ObjectFile::getFileFormatName ( ) const [pure virtual]
virtual std::error_code llvm::object::ObjectFile::getPlatformFlags ( unsigned Result) const [inline, virtual]

Returns platform-specific object flags, if any.

Reimplemented in llvm::object::ELFObjectFile< ELFT >.

Definition at line 300 of file ObjectFile.h.

References llvm::object::invalid_file_type.

Referenced by llvm::RuntimeDyldELF::processRelocationRef().

section_iterator ObjectFile::getRelocatedSection ( DataRefImpl  Sec) const [protected, virtual]

Reimplemented in llvm::object::ELFObjectFile< ELFT >.

Definition at line 46 of file ObjectFile.cpp.

References SectionRef.

Referenced by llvm::object::SectionRef::getRelocatedSection().

virtual std::error_code llvm::object::ObjectFile::getRelocationAddress ( DataRefImpl  Rel,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getRelocationHidden ( DataRefImpl  Rel,
bool Result 
) const [inline, protected, virtual]

Reimplemented in llvm::object::MachOObjectFile.

Definition at line 272 of file ObjectFile.h.

References llvm::object::success.

Referenced by llvm::object::RelocationRef::getHidden().

virtual std::error_code llvm::object::ObjectFile::getRelocationOffset ( DataRefImpl  Rel,
uint64_t &  Res 
) const [protected, pure virtual]
virtual symbol_iterator llvm::object::ObjectFile::getRelocationSymbol ( DataRefImpl  Rel) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getRelocationType ( DataRefImpl  Rel,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getRelocationTypeName ( DataRefImpl  Rel,
SmallVectorImpl< char > &  Result 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getRelocationValueString ( DataRefImpl  Rel,
SmallVectorImpl< char > &  Result 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSectionAddress ( DataRefImpl  Sec,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSectionAlignment ( DataRefImpl  Sec,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSectionContents ( DataRefImpl  Sec,
StringRef Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSectionName ( DataRefImpl  Sec,
StringRef Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSectionSize ( DataRefImpl  Sec,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSymbolAddress ( DataRefImpl  Symb,
uint64_t &  Res 
) const [protected, pure virtual]
std::error_code ObjectFile::getSymbolAlignment ( DataRefImpl  Symb,
uint32_t &  Res 
) const [protected, virtual]
virtual std::error_code llvm::object::ObjectFile::getSymbolName ( DataRefImpl  Symb,
StringRef Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSymbolOther ( DataRefImpl  Symb,
uint8_t &  Res 
) const [inline, protected, virtual]

Reimplemented in llvm::object::ELFObjectFile< ELFT >.

Definition at line 219 of file ObjectFile.h.

References llvm::object::invalid_file_type.

Referenced by llvm::object::SymbolRef::getOther().

virtual std::error_code llvm::object::ObjectFile::getSymbolSection ( DataRefImpl  Symb,
section_iterator Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSymbolSize ( DataRefImpl  Symb,
uint64_t &  Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::getSymbolType ( DataRefImpl  Symb,
SymbolRef::Type Res 
) const [protected, pure virtual]
virtual bool llvm::object::ObjectFile::isRelocatableObject ( ) const [pure virtual]

True if this is a relocatable object (.o/.obj).

Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, and llvm::object::ELFObjectFile< ELFT >.

virtual std::error_code llvm::object::ObjectFile::isSectionBSS ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionData ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionReadOnlyData ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionRequiredForExecution ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionText ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionVirtual ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::isSectionZeroInit ( DataRefImpl  Sec,
bool Res 
) const [protected, pure virtual]
virtual void llvm::object::ObjectFile::moveRelocationNext ( DataRefImpl Rel) const [protected, pure virtual]
virtual void llvm::object::ObjectFile::moveSectionNext ( DataRefImpl Sec) const [protected, pure virtual]
std::error_code ObjectFile::printSymbolName ( raw_ostream OS,
DataRefImpl  Symb 
) const [override, protected, virtual]

Implements llvm::object::SymbolicFile.

Definition at line 31 of file ObjectFile.cpp.

References getSymbolName(), Name, and llvm::object::success.

virtual section_iterator llvm::object::ObjectFile::section_end ( ) const [pure virtual]
virtual relocation_iterator llvm::object::ObjectFile::section_rel_begin ( DataRefImpl  Sec) const [protected, pure virtual]
virtual relocation_iterator llvm::object::ObjectFile::section_rel_end ( DataRefImpl  Sec) const [protected, pure virtual]
virtual std::error_code llvm::object::ObjectFile::sectionContainsSymbol ( DataRefImpl  Sec,
DataRefImpl  Symb,
bool Result 
) const [protected, pure virtual]

Friends And Related Function Documentation

friend class RelocationRef [friend]
friend class SectionRef [friend]
friend class SymbolRef [friend]

The documentation for this class was generated from the following files: