LLVM
8.0.1
|
This class is the base class for all object file types. More...
#include "llvm/Object/ObjectFile.h"
Public Types | |
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 > |
Friends | |
class | SymbolRef |
class | SectionRef |
class | RelocationRef |
Additional Inherited Members | |
Protected Types inherited from llvm::object::Binary | |
enum | { ID_Archive, ID_MachOUniversalBinary, ID_COFFImportFile, ID_IR, ID_WinRes, ID_StartObjects, ID_COFF, ID_ELF32L, ID_ELF32B, ID_ELF64L, ID_ELF64B, ID_MachO32L, ID_MachO32B, ID_MachO64L, ID_MachO64B, ID_Wasm, ID_EndObjects } |
Static Protected Member Functions inherited from llvm::object::Binary | |
static unsigned int | getELFType (bool isLE, bool is64Bits) |
static unsigned int | getMachOType (bool isLE, bool is64Bits) |
Protected Attributes inherited from llvm::object::Binary | |
MemoryBufferRef | Data |
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 202 of file ObjectFile.h.
Definition at line 291 of file ObjectFile.h.
Definition at line 283 of file ObjectFile.h.
|
protected |
Definition at line 38 of file ObjectFile.cpp.
|
delete |
|
delete |
|
inlineprotected |
Definition at line 208 of file ObjectFile.h.
References llvm::Data.
Referenced by llvm::object::COFFObjectFile::COFFObjectFile(), llvm::object::ELFObjectFile< ELFT >::dynamic_relocation_sections(), llvm::object::COFFObjectFile::getRelocations(), llvm::object::COFFObjectFile::getRvaAndSizeAsBytes(), llvm::object::COFFObjectFile::getRvaPtr(), llvm::object::ELFObjectFile< ELFT >::getSectionContents(), llvm::object::COFFObjectFile::getSectionContents(), llvm::object::COFFObjectFile::getSymbolAuxData(), llvm::object::COFFObjectFile::section_rel_begin(), llvm::object::COFFObjectFile::section_rel_end(), and llvm::object::COFFObjectFile::toSymb().
Definition at line 336 of file ObjectFile.h.
References llvm::object::Binary::isObject().
|
static |
Definition at line 1644 of file COFFObjectFile.cpp.
References llvm::object::COFFObjectFile::COFFObjectFile(), llvm::errorCodeToError(), and llvm::MipsISD::Ret.
Referenced by makeTriple().
|
static |
Definition at line 52 of file ELFObjectFile.cpp.
References llvm::countTrailingZeros(), llvm::object::createError(), llvm::ELF::ELFCLASS32, llvm::ELF::ELFCLASS64, llvm::ELF::ELFDATA2LSB, llvm::ELF::ELFDATA2MSB, llvm::MemoryBufferRef::getBuffer(), llvm::MemoryBufferRef::getBufferStart(), and llvm::object::getElfArchType().
Referenced by makeTriple().
|
static |
Definition at line 4603 of file MachOObjectFile.cpp.
References llvm::object::MachOObjectFile::create(), llvm::MemoryBufferRef::getBuffer(), llvm::object::invalid_file_type, Magic, and llvm::StringRef::slice().
Referenced by llvm::object::MachOUniversalBinary::ObjectForArch::getAsObjectFile(), and makeTriple().
|
static |
ObjectPath | The path to the object file. ObjectPath.isObject must return true. Create ObjectFile from path. |
Definition at line 161 of file ObjectFile.cpp.
References llvm::errorCodeToError(), llvm::ErrorOr< T >::get(), llvm::ErrorOr< T >::getError(), and llvm::MemoryBuffer::getFile().
Referenced by llvm::OrcCBindingsStack::addObject(), llvm::orc::LegacyRTDyldObjectLinkingLayer::addObject(), llvm::orc::RTDyldObjectLinkingLayer::emit(), llvm::MCJIT::generateCodeForModule(), llvm::DWARFContext::getDWOContext(), llvm::orc::getObjectSymbolFlags(), LLVMCreateObjectFile(), llvm::xray::loadInstrumentationMap(), makeTriple(), llvm::orc::SimpleCompiler::operator()(), and llvm::object::SymbolicFile::SymbolicFile().
|
static |
|
inlinestatic |
Definition at line 332 of file ObjectFile.h.
References llvm::file_magic::unknown.
|
static |
Definition at line 57 of file WasmObjectFile.cpp.
Referenced by makeTriple().
|
inlinevirtual |
Reimplemented in llvm::object::ELFObjectFile< ELFT >.
Definition at line 279 of file ObjectFile.h.
|
pure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::ELFObjectFile< ELFT >, llvm::object::MachOObjectFile, and llvm::object::WasmObjectFile.
Referenced by llvm::symbolize::SymbolizableObjectFile::create(), llvm::object::RelocVisitor::error(), llvm::object::ELFObjectFile< ELFT >::getSection(), loadObj(), llvm::RuntimeDyld::loadObject(), llvm::RuntimeDyldImpl::loadObjectImpl(), llvm::DWARFContext::loadRegisterInfo(), and makeTriple().
|
inlinevirtual |
Reimplemented in llvm::object::ELFObjectFile< ELFT >.
Definition at line 312 of file ObjectFile.h.
Referenced by llvm::object::ELFObjectFileBase::getARMFeatures(), and llvm::object::ELFObjectFileBase::setARMSubArch().
|
pure virtual |
The number of bytes used to represent an address in this object file format.
Implemented in llvm::object::COFFObjectFile, llvm::object::ELFObjectFile< ELFT >, llvm::object::MachOObjectFile, and llvm::object::WasmObjectFile.
Referenced by llvm::symbolize::SymbolizableObjectFile::create(), llvm::object::RelocVisitor::error(), and llvm::object::ELFObjectFile< ELFT >::getSection().
|
inline |
Definition at line 274 of file ObjectFile.h.
References assert(), and llvm::object::BasicSymbolRef::SF_Common.
Referenced by llvm::object::SymbolRef::getCommonSize(), and getSymbolValue().
|
protectedpure virtual |
|
pure virtual |
|
pure virtual |
|
protectedvirtual |
Reimplemented in llvm::object::ELFObjectFile< ELFT >.
Definition at line 88 of file ObjectFile.cpp.
References SectionRef.
Referenced by llvm::object::SectionRef::getRelocatedSection().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::RelocationRef::getOffset().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::RelocationRef::getSymbol().
|
protectedpure virtual |
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::RelocationRef::getTypeName().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getAddress().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getAlignment().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getContents().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getIndex().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getName(), and isSectionBitcode().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::getSize().
|
inlinevirtual |
Reimplemented in llvm::object::COFFObjectFile, and llvm::object::ELFObjectFile< ELFT >.
Definition at line 304 of file ObjectFile.h.
References llvm::errorCodeToError(), and llvm::object::parse_failed.
Referenced by llvm::object::ELFObjectFile< ELFT >::getSection().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SymbolRef::getAddress().
|
protectedvirtual |
Reimplemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Definition at line 69 of file ObjectFile.cpp.
Referenced by llvm::object::SymbolRef::getAlignment().
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SymbolRef::getType().
|
protected |
Definition at line 51 of file ObjectFile.cpp.
References getCommonSymbolSize(), llvm::object::SymbolicFile::getSymbolFlags(), getSymbolValueImpl(), llvm::object::BasicSymbolRef::SF_Common, and llvm::object::BasicSymbolRef::SF_Undefined.
Referenced by llvm::object::WasmObjectFile::getSymbolAddress(), llvm::object::ELFObjectFile< ELFT >::getSymbolAddress(), llvm::object::COFFObjectFile::getSymbolAddress(), and llvm::object::SymbolRef::getValue().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by getSymbolValue().
|
protectedvirtual |
Reimplemented in llvm::object::ELFObjectFile< ELFT >.
Definition at line 84 of file ObjectFile.cpp.
References isSectionData().
Referenced by llvm::object::SectionRef::isBerkeleyData().
|
protectedvirtual |
Reimplemented in llvm::object::ELFObjectFile< ELFT >.
Definition at line 80 of file ObjectFile.cpp.
References isSectionText().
Referenced by llvm::object::ELFObjectFile< ELFT >::isBerkeleyData(), and llvm::object::SectionRef::isBerkeleyText().
|
pure virtual |
True if this is a relocatable object (.o/.obj).
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::ELFObjectFile< ELFT >::classof().
|
protectedvirtual |
Reimplemented in llvm::object::MachOObjectFile, and llvm::object::WasmObjectFile.
Definition at line 71 of file ObjectFile.cpp.
References getSectionName().
Referenced by llvm::object::SectionRef::isBitcode().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::isBSS().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::isCompressed().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by isBerkeleyData(), and llvm::object::SectionRef::isData().
|
protectedvirtual |
Reimplemented in llvm::object::MachOObjectFile.
Definition at line 78 of file ObjectFile.cpp.
Referenced by llvm::object::SectionRef::isStripped().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by isBerkeleyText(), and llvm::object::SectionRef::isText().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::isVirtual().
Triple ObjectFile::makeTriple | ( | ) | const |
Create a triple from the data in this object file.
Definition at line 92 of file ObjectFile.cpp.
References llvm::file_magic::archive, llvm::Triple::arm, llvm::Triple::armeb, llvm::file_magic::bitcode, llvm::file_magic::coff_cl_gl_object, llvm::file_magic::coff_import_library, llvm::file_magic::coff_object, createCOFFObjectFile(), createELFObjectFile(), createMachOObjectFile(), createObjectFile(), createWasmObjectFile(), llvm::object::Binary::Data, llvm::dyn_cast(), llvm::file_magic::elf, llvm::file_magic::elf_core, llvm::file_magic::elf_executable, llvm::file_magic::elf_relocatable, llvm::file_magic::elf_shared_object, llvm::errorCodeToError(), getArch(), llvm::MemoryBufferRef::getBuffer(), llvm::identify_magic(), llvm::object::invalid_file_type, llvm::object::Binary::isCOFF(), llvm::object::Binary::isMachO(), llvm_unreachable, llvm::Triple::MachO, llvm::file_magic::macho_bundle, llvm::file_magic::macho_core, llvm::file_magic::macho_dsym_companion, llvm::file_magic::macho_dynamic_linker, llvm::file_magic::macho_dynamically_linked_shared_lib, llvm::file_magic::macho_dynamically_linked_shared_lib_stub, llvm::file_magic::macho_executable, llvm::file_magic::macho_fixed_virtual_memory_shared_lib, llvm::file_magic::macho_kext_bundle, llvm::file_magic::macho_object, llvm::file_magic::macho_preload_executable, llvm::file_magic::macho_universal_binary, llvm::file_magic::pdb, llvm::file_magic::pecoff_executable, llvm::Triple::setArch(), setARMSubArch(), llvm::Triple::setObjectFormat(), llvm::Triple::setTriple(), llvm::Triple::thumb, llvm::file_magic::unknown, llvm::file_magic::wasm_object, and llvm::file_magic::windows_resource.
|
inlinevirtual |
Maps a debug section name to a standard DWARF section name.
Reimplemented in llvm::object::COFFObjectFile, and llvm::object::MachOObjectFile.
Definition at line 317 of file ObjectFile.h.
References Name.
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::RelocationRef::moveNext().
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::moveNext().
|
overrideprotectedvirtual |
Implements llvm::object::SymbolicFile.
Definition at line 60 of file ObjectFile.cpp.
References llvm::errorToErrorCode(), getSymbolName(), Name, and llvm::Expected< T >::takeError().
|
pure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::ELFObjectFile< ELFT >, llvm::object::MachOObjectFile, and llvm::object::WasmObjectFile.
Referenced by llvm::RuntimeDyldImpl::computeGOTSize(), llvm::RuntimeDyldImpl::computeSectionStubBufSize(), llvm::RuntimeDyldImpl::computeTotalAllocSize(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::object::ELFObjectFile< ELFT >::getSection(), and llvm::RuntimeDyldELF::loadObject().
|
pure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::ELFObjectFile< ELFT >, llvm::object::MachOObjectFile, and llvm::object::WasmObjectFile.
Referenced by llvm::RuntimeDyldImpl::computeGOTSize(), llvm::RuntimeDyldImpl::computeSectionStubBufSize(), llvm::RuntimeDyldImpl::computeTotalAllocSize(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::object::ELFObjectFile< ELFT >::getRelocatedSection(), llvm::object::ELFObjectFile< ELFT >::getSection(), getSymbolInfo(), llvm::object::ELFObjectFile< ELFT >::getSymbolSection(), llvm::RuntimeDyldELF::loadObject(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldCOFFX86_64::processRelocationRef().
|
protectedpure virtual |
|
protectedpure virtual |
Implemented in llvm::object::COFFObjectFile, llvm::object::MachOObjectFile, llvm::object::ELFObjectFile< ELFT >, and llvm::object::WasmObjectFile.
Referenced by llvm::object::SectionRef::relocation_end().
|
inline |
Definition at line 292 of file ObjectFile.h.
References getFeatures().
Referenced by llvm::object::BindRebaseSegInfo::BindRebaseSegInfo(), llvm::object::computeSymbolSizes(), llvm::symbolize::SymbolizableObjectFile::create(), llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOX86_64 >::finalizeLoad(), llvm::object::IRObjectFile::findBitcodeInObject(), llvm::symbolize::LLVMSymbolizer::flush(), llvm::object::COFFObjectFile::getDataDirectory(), llvm::object::COFFObjectFile::getRvaAndSizeAsBytes(), llvm::object::COFFObjectFile::getRvaPtr(), loadObj(), and llvm::RuntimeDyldELF::loadObject().
|
inlinevirtual |
Reimplemented in llvm::object::ELFObjectFileBase.
Definition at line 303 of file ObjectFile.h.
Referenced by makeTriple().
|
inline |
Definition at line 284 of file ObjectFile.h.
|
friend |
Definition at line 260 of file ObjectFile.h.
Referenced by llvm::object::WasmObjectFile::section_rel_begin(), llvm::object::ELFObjectFile< ELFT >::section_rel_begin(), llvm::object::COFFObjectFile::section_rel_begin(), llvm::object::WasmObjectFile::section_rel_end(), llvm::object::ELFObjectFile< ELFT >::section_rel_end(), and llvm::object::COFFObjectFile::section_rel_end().
|
friend |
Definition at line 234 of file ObjectFile.h.
Referenced by getRelocatedSection(), llvm::object::ELFObjectFile< ELFT >::getRelocatedSection(), llvm::object::WasmObjectFile::getSymbolSection(), llvm::object::ELFObjectFile< ELFT >::getSymbolSection(), llvm::object::COFFObjectFile::getSymbolSection(), llvm::object::WasmObjectFile::section_begin(), llvm::object::ELFObjectFile< ELFT >::section_begin(), llvm::object::COFFObjectFile::section_begin(), llvm::object::WasmObjectFile::section_end(), llvm::object::ELFObjectFile< ELFT >::section_end(), and llvm::object::COFFObjectFile::section_end().
|
friend |
Definition at line 220 of file ObjectFile.h.
Referenced by llvm::object::ELFObjectFile< ELFT >::dynamic_symbol_begin(), llvm::object::ELFObjectFile< ELFT >::dynamic_symbol_end(), llvm::object::WasmObjectFile::getRelocationSymbol(), llvm::object::ELFObjectFile< ELFT >::getRelocationSymbol(), llvm::object::COFFObjectFile::getRelocationSymbol(), llvm::object::ELFObjectFile< ELFT >::symbol_begin(), llvm::object::COFFObjectFile::symbol_begin(), llvm::object::ELFObjectFile< ELFT >::symbol_end(), and llvm::object::COFFObjectFile::symbol_end().