class ObjectFile

Declaration

class ObjectFile : public SymbolicFile { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/Object/ObjectFile.h:228

Inherits from: SymbolicFile

Member Variables

Inherited from Binary:

protected Data

Method Overview

  • protected ObjectFile(unsigned int Type, llvm::MemoryBufferRef Source)
  • public ObjectFile(const llvm::object::ObjectFile & other)
  • public ObjectFile()
  • private virtual void anchor()
  • protected const uint8_t * base() const
  • public static bool classof(const llvm::object::Binary * v)
  • public static Expected<std::unique_ptr<COFFObjectFile>> createCOFFObjectFile(llvm::MemoryBufferRef Object)
  • public static Expected<std::unique_ptr<ObjectFile>> createELFObjectFile(llvm::MemoryBufferRef Object, bool InitContent = true)
  • public static Expected<std::unique_ptr<MachOObjectFile>> createMachOObjectFile(llvm::MemoryBufferRef Object, uint32_t UniversalCputype = 0, uint32_t UniversalIndex = 0)
  • public static Expected<std::unique_ptr<ObjectFile>> createObjectFile(llvm::MemoryBufferRef Object)
  • public static Expected<std::unique_ptr<ObjectFile>> createObjectFile(llvm::MemoryBufferRef Object, llvm::file_magic Type, bool InitContent = true)
  • public static Expected<OwningBinary<llvm::object::ObjectFile>> createObjectFile(llvm::StringRef ObjectPath)
  • public static Expected<std::unique_ptr<WasmObjectFile>> createWasmObjectFile(llvm::MemoryBufferRef Object)
  • public static Expected<std::unique_ptr<ObjectFile>> createXCOFFObjectFile(llvm::MemoryBufferRef Object, unsigned int FileType)
  • public virtual std::vector<SectionRef> dynamic_relocation_sections() const
  • public virtual Triple::ArchType getArch() const
  • public virtual uint8_t getBytesInAddress() const
  • public uint64_t getCommonSymbolSize(llvm::object::DataRefImpl Symb) const
  • protected virtual uint64_t getCommonSymbolSizeImpl(llvm::object::DataRefImpl Symb) const
  • public virtual llvm::SubtargetFeatures getFeatures() const
  • public virtual llvm::StringRef getFileFormatName() const
  • protected virtual Expected<llvm::object::section_iterator> getRelocatedSection(llvm::object::DataRefImpl Sec) const
  • protected virtual uint64_t getRelocationOffset(llvm::object::DataRefImpl Rel) const
  • protected virtual llvm::object::symbol_iterator getRelocationSymbol(llvm::object::DataRefImpl Rel) const
  • protected virtual uint64_t getRelocationType(llvm::object::DataRefImpl Rel) const
  • protected virtual void getRelocationTypeName(llvm::object::DataRefImpl Rel, SmallVectorImpl<char> & Result) const
  • protected virtual uint64_t getSectionAddress(llvm::object::DataRefImpl Sec) const
  • protected virtual uint64_t getSectionAlignment(llvm::object::DataRefImpl Sec) const
  • protected virtual Expected<ArrayRef<uint8_t>> getSectionContents(llvm::object::DataRefImpl Sec) const
  • protected virtual uint64_t getSectionIndex(llvm::object::DataRefImpl Sec) const
  • protected virtual Expected<llvm::StringRef> getSectionName(llvm::object::DataRefImpl Sec) const
  • protected virtual uint64_t getSectionSize(llvm::object::DataRefImpl Sec) const
  • public virtual Expected<uint64_t> getStartAddress() const
  • protected virtual Expected<uint64_t> getSymbolAddress(llvm::object::DataRefImpl Symb) const
  • protected virtual uint32_t getSymbolAlignment(llvm::object::DataRefImpl Symb) const
  • protected virtual Expected<llvm::StringRef> getSymbolName(llvm::object::DataRefImpl Symb) const
  • protected virtual Expected<llvm::object::section_iterator> getSymbolSection(llvm::object::DataRefImpl Symb) const
  • protected virtual Expected<SymbolRef::Type> getSymbolType(llvm::object::DataRefImpl Symb) const
  • protected Expected<uint64_t> getSymbolValue(llvm::object::DataRefImpl Symb) const
  • protected virtual uint64_t getSymbolValueImpl(llvm::object::DataRefImpl Symb) const
  • protected virtual bool isBerkeleyData(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isBerkeleyText(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isDebugSection(llvm::object::DataRefImpl Sec) const
  • public bool isReflectionSectionStrippable(llvm::binaryformat::Swift5ReflectionSectionKind ReflectionSectionKind) const
  • public virtual bool isRelocatableObject() const
  • protected virtual bool isSectionBSS(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionBitcode(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionCompressed(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionData(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionStripped(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionText(llvm::object::DataRefImpl Sec) const
  • protected virtual bool isSectionVirtual(llvm::object::DataRefImpl Sec) const
  • public llvm::Triple makeTriple() const
  • public virtual llvm::StringRef mapDebugSectionName(llvm::StringRef Name) const
  • protected virtual llvm::binaryformat::Swift5ReflectionSectionKind mapReflectionSectionNameToEnumValue(llvm::StringRef SectionName) const
  • protected virtual void moveRelocationNext(llvm::object::DataRefImpl & Rel) const
  • protected virtual void moveSectionNext(llvm::object::DataRefImpl & Sec) const
  • protected llvm::Error printSymbolName(llvm::raw_ostream & OS, llvm::object::DataRefImpl Symb) const
  • public virtual llvm::object::section_iterator section_begin() const
  • public virtual llvm::object::section_iterator section_end() const
  • protected virtual llvm::object::relocation_iterator section_rel_begin(llvm::object::DataRefImpl Sec) const
  • protected virtual llvm::object::relocation_iterator section_rel_end(llvm::object::DataRefImpl Sec) const
  • public llvm::object::ObjectFile::section_iterator_range sections() const
  • public virtual void setARMSubArch(llvm::Triple & TheTriple) const
  • public llvm::object::ObjectFile::symbol_iterator_range symbols() const
  • public virtual Optional<llvm::StringRef> tryGetCPUName() const

Inherited from SymbolicFile:

Inherited from Binary:

Methods

ObjectFile(unsigned int Type,
           llvm::MemoryBufferRef Source)

Declared at: llvm/include/llvm/Object/ObjectFile.h:232

Parameters

unsigned int Type
llvm::MemoryBufferRef Source

ObjectFile(const llvm::object::ObjectFile& other)

Declared at: llvm/include/llvm/Object/ObjectFile.h:303

Parameters

const llvm::object::ObjectFile& other

ObjectFile()

Declared at: llvm/include/llvm/Object/ObjectFile.h:302

virtual void anchor()

Declared at: llvm/include/llvm/Object/ObjectFile.h:229

const uint8_t* base() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:234

static bool classof(const llvm::object::Binary* v)

Declared at: llvm/include/llvm/Object/ObjectFile.h:373

Parameters

const llvm::object::Binary* v

static Expected<std::unique_ptr<COFFObjectFile>>
createCOFFObjectFile(llvm::MemoryBufferRef Object)

Declared at: llvm/include/llvm/Object/ObjectFile.h:378

Parameters

llvm::MemoryBufferRef Object

static Expected<std::unique_ptr<ObjectFile>>
createELFObjectFile(llvm::MemoryBufferRef Object,
                    bool InitContent = true)

Declared at: llvm/include/llvm/Object/ObjectFile.h:384

Parameters

llvm::MemoryBufferRef Object
bool InitContent = true

static Expected<std::unique_ptr<MachOObjectFile>>
createMachOObjectFile(
    llvm::MemoryBufferRef Object,
    uint32_t UniversalCputype = 0,
    uint32_t UniversalIndex = 0)

Declared at: llvm/include/llvm/Object/ObjectFile.h:387

Parameters

llvm::MemoryBufferRef Object
uint32_t UniversalCputype = 0
uint32_t UniversalIndex = 0

static Expected<std::unique_ptr<ObjectFile>>
createObjectFile(llvm::MemoryBufferRef Object)

Declared at: llvm/include/llvm/Object/ObjectFile.h:369

Parameters

llvm::MemoryBufferRef Object

static Expected<std::unique_ptr<ObjectFile>>
createObjectFile(llvm::MemoryBufferRef Object,
                 llvm::file_magic Type,
                 bool InitContent = true)

Declared at: llvm/include/llvm/Object/ObjectFile.h:366

Parameters

llvm::MemoryBufferRef Object
llvm::file_magic Type
bool InitContent = true

static Expected<
    OwningBinary<llvm::object::ObjectFile>>
createObjectFile(llvm::StringRef ObjectPath)

Declared at: llvm/include/llvm/Object/ObjectFile.h:363

Parameters

llvm::StringRef ObjectPath
The path to the object file. ObjectPath.isObject must return true. Create ObjectFile from path.

Returns

Pointer to ObjectFile subclass to handle this type of object.

static Expected<std::unique_ptr<WasmObjectFile>>
createWasmObjectFile(llvm::MemoryBufferRef Object)

Declared at: llvm/include/llvm/Object/ObjectFile.h:392

Parameters

llvm::MemoryBufferRef Object

static Expected<std::unique_ptr<ObjectFile>>
createXCOFFObjectFile(
    llvm::MemoryBufferRef Object,
    unsigned int FileType)

Declared at: llvm/include/llvm/Object/ObjectFile.h:381

Parameters

llvm::MemoryBufferRef Object
unsigned int FileType

virtual std::vector<SectionRef>
dynamic_relocation_sections() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:314

virtual Triple::ArchType getArch() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:336

virtual uint8_t getBytesInAddress() const

Description

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

Declared at: llvm/include/llvm/Object/ObjectFile.h:333

uint64_t getCommonSymbolSize(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:305

Parameters

llvm::object::DataRefImpl Symb

virtual uint64_t getCommonSymbolSizeImpl(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:254

Parameters

llvm::object::DataRefImpl Symb

virtual llvm::SubtargetFeatures getFeatures()
    const

Declared at: llvm/include/llvm/Object/ObjectFile.h:337

virtual llvm::StringRef getFileFormatName() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:335

virtual Expected<llvm::object::section_iterator>
getRelocatedSection(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:283

Parameters

llvm::object::DataRefImpl Sec

virtual uint64_t getRelocationOffset(
    llvm::object::DataRefImpl Rel) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:288

Parameters

llvm::object::DataRefImpl Rel

virtual llvm::object::symbol_iterator
getRelocationSymbol(
    llvm::object::DataRefImpl Rel) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:289

Parameters

llvm::object::DataRefImpl Rel

virtual uint64_t getRelocationType(
    llvm::object::DataRefImpl Rel) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:290

Parameters

llvm::object::DataRefImpl Rel

virtual void getRelocationTypeName(
    llvm::object::DataRefImpl Rel,
    SmallVectorImpl<char>& Result) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:291

Parameters

llvm::object::DataRefImpl Rel
SmallVectorImpl<char>& Result

virtual uint64_t getSectionAddress(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:264

Parameters

llvm::object::DataRefImpl Sec

virtual uint64_t getSectionAlignment(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:269

Parameters

llvm::object::DataRefImpl Sec

virtual Expected<ArrayRef<uint8_t>>
getSectionContents(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:268

Parameters

llvm::object::DataRefImpl Sec

virtual uint64_t getSectionIndex(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:265

Parameters

llvm::object::DataRefImpl Sec

virtual Expected<llvm::StringRef> getSectionName(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:263

Parameters

llvm::object::DataRefImpl Sec

virtual uint64_t getSectionSize(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:266

Parameters

llvm::object::DataRefImpl Sec

virtual Expected<uint64_t> getStartAddress() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:340

virtual Expected<uint64_t> getSymbolAddress(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:251

Parameters

llvm::object::DataRefImpl Symb

virtual uint32_t getSymbolAlignment(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:253

Parameters

llvm::object::DataRefImpl Symb

virtual Expected<llvm::StringRef> getSymbolName(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:248

Parameters

llvm::object::DataRefImpl Symb

virtual Expected<llvm::object::section_iterator>
getSymbolSection(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:257

Parameters

llvm::object::DataRefImpl Symb

virtual Expected<SymbolRef::Type> getSymbolType(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:255

Parameters

llvm::object::DataRefImpl Symb

Expected<uint64_t> getSymbolValue(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:299

Parameters

llvm::object::DataRefImpl Symb

virtual uint64_t getSymbolValueImpl(
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:252

Parameters

llvm::object::DataRefImpl Symb

virtual bool isBerkeleyData(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:279

Parameters

llvm::object::DataRefImpl Sec

virtual bool isBerkeleyText(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:278

Parameters

llvm::object::DataRefImpl Sec

virtual bool isDebugSection(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:280

Parameters

llvm::object::DataRefImpl Sec

bool isReflectionSectionStrippable(
    llvm::binaryformat::
        Swift5ReflectionSectionKind
            ReflectionSectionKind) const

Description

True if the reflection section can be stripped by the linker.

Declared at: llvm/include/llvm/Object/ObjectFile.h:354

Parameters

llvm::binaryformat::Swift5ReflectionSectionKind ReflectionSectionKind

virtual bool isRelocatableObject() const

Description

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

Declared at: llvm/include/llvm/Object/ObjectFile.h:351

virtual bool isSectionBSS(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:273

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionBitcode(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:276

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionCompressed(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:270

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionData(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:272

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionStripped(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:277

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionText(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:271

Parameters

llvm::object::DataRefImpl Sec

virtual bool isSectionVirtual(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:275

Parameters

llvm::object::DataRefImpl Sec

llvm::Triple makeTriple() const

Description

Create a triple from the data in this object file.

Declared at: llvm/include/llvm/Object/ObjectFile.h:345

virtual llvm::StringRef mapDebugSectionName(
    llvm::StringRef Name) const

Description

Maps a debug section name to a standard DWARF section name.

Declared at: llvm/include/llvm/Object/ObjectFile.h:348

Parameters

llvm::StringRef Name

virtual llvm::binaryformat::
    Swift5ReflectionSectionKind
    mapReflectionSectionNameToEnumValue(
        llvm::StringRef SectionName) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:295

Parameters

llvm::StringRef SectionName

virtual void moveRelocationNext(
    llvm::object::DataRefImpl& Rel) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:287

Parameters

llvm::object::DataRefImpl& Rel

virtual void moveSectionNext(
    llvm::object::DataRefImpl& Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:262

Parameters

llvm::object::DataRefImpl& Sec

llvm::Error printSymbolName(
    llvm::raw_ostream& OS,
    llvm::object::DataRefImpl Symb) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:249

Parameters

llvm::raw_ostream& OS
llvm::object::DataRefImpl Symb

virtual llvm::object::section_iterator
section_begin() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:323

virtual llvm::object::section_iterator
section_end() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:324

virtual llvm::object::relocation_iterator
section_rel_begin(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:281

Parameters

llvm::object::DataRefImpl Sec

virtual llvm::object::relocation_iterator
section_rel_end(
    llvm::object::DataRefImpl Sec) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:282

Parameters

llvm::object::DataRefImpl Sec

llvm::object::ObjectFile::section_iterator_range
sections() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:327

virtual void setARMSubArch(
    llvm::Triple& TheTriple) const

Declared at: llvm/include/llvm/Object/ObjectFile.h:339

Parameters

llvm::Triple& TheTriple

llvm::object::ObjectFile::symbol_iterator_range
symbols() const

Declared at: llvm/include/llvm/Object/ObjectFile.h:319

virtual Optional<llvm::StringRef> tryGetCPUName()
    const

Declared at: llvm/include/llvm/Object/ObjectFile.h:338