LLVM API Documentation
#include <COFF.h>
Static Public Member Functions | |
static bool | classof (const Binary *v) |
![]() | |
static ObjectFile * | createObjectFile (StringRef ObjectPath) |
Create ObjectFile from path. More... | |
static ObjectFile * | createObjectFile (MemoryBuffer *Object) |
static bool | classof (const Binary *v) |
static ObjectFile * | createCOFFObjectFile (MemoryBuffer *Object) |
static ObjectFile * | createELFObjectFile (MemoryBuffer *Object) |
static ObjectFile * | createMachOObjectFile (MemoryBuffer *Object) |
Friends | |
class | ImportDirectoryEntryRef |
Additional Inherited Members | |
![]() | |
enum | { ID_Archive, ID_MachOUniversalBinary, ID_StartObjects, ID_COFF, ID_ELF32L, ID_ELF32B, ID_ELF64L, ID_ELF64B, ID_MachO32L, ID_MachO32B, ID_MachO64L, ID_MachO64B, ID_EndObjects } |
![]() | |
static unsigned int | getELFType (bool isLE, bool is64Bits) |
static unsigned int | getMachOType (bool isLE, bool is64Bits) |
![]() | |
MemoryBuffer * | Data |
Definition at line 223 of file Object/COFF.h.
COFFObjectFile::COFFObjectFile | ( | MemoryBuffer * | Object, |
error_code & | ec | ||
) |
Definition at line 453 of file COFFObjectFile.cpp.
References llvm::object::ObjectFile::base(), llvm::object::Binary::Data, if(), llvm::object::coff_file_header::isImportLibrary(), llvm::object::pe32_header::Magic, llvm::LibFunc::memcmp, llvm::object::pe32_header::NumberOfRvaAndSize, llvm::object::coff_file_header::NumberOfSections, llvm::object::object_error::parse_failed, llvm::object::coff_file_header::PointerToSymbolTable, llvm::object::coff_file_header::SizeOfOptionalHeader, and llvm::object::object_error::success.
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 540 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 550 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 582 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, and llvm::object::ObjectFile::SectionRef.
Referenced by getRvaPtr().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 527 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, and llvm::object::ObjectFile::SymbolRef.
Definition at line 341 of file Object/COFF.h.
References llvm::object::Binary::isCOFF().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 545 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 555 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 588 of file COFFObjectFile.cpp.
References llvm::object::coff_file_header::isImportLibrary(), llvm::object::coff_file_header::NumberOfSections, llvm::object::DataRefImpl::p, and llvm::object::ObjectFile::SectionRef.
Referenced by getRvaPtr(), and getSymbolSection().
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 533 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, and llvm::object::ObjectFile::SymbolRef.
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 611 of file COFFObjectFile.cpp.
References llvm::COFF::IMAGE_FILE_MACHINE_AMD64, llvm::COFF::IMAGE_FILE_MACHINE_I386, llvm::object::coff_file_header::Machine, llvm::Triple::UnknownArch, llvm::Triple::x86, and llvm::Triple::x86_64.
Referenced by getBytesInAddress().
|
inline |
Definition at line 325 of file Object/COFF.h.
References getSymbol().
|
virtual |
The number of bytes used to represent an address in this object file format.
Implements llvm::object::ObjectFile.
Definition at line 596 of file COFFObjectFile.cpp.
References getArch(), and llvm::Triple::x86_64.
error_code COFFObjectFile::getCOFFHeader | ( | const coff_file_header *& | Res | ) | const |
Definition at line 628 of file COFFObjectFile.cpp.
References llvm::object::object_error::success.
Referenced by getHeader().
const coff_relocation * COFFObjectFile::getCOFFRelocation | ( | relocation_iterator & | It | ) | const |
Definition at line 800 of file COFFObjectFile.cpp.
const coff_section * COFFObjectFile::getCOFFSection | ( | section_iterator & | It | ) | const |
Definition at line 792 of file COFFObjectFile.cpp.
Referenced by getRvaPtr().
const coff_symbol * COFFObjectFile::getCOFFSymbol | ( | symbol_iterator & | It | ) | const |
Definition at line 796 of file COFFObjectFile.cpp.
error_code COFFObjectFile::getDataDirectory | ( | uint32_t | index, |
const data_directory *& | Res | ||
) | const |
Definition at line 638 of file COFFObjectFile.cpp.
References llvm::object::pe32_header::NumberOfRvaAndSize, llvm::object::object_error::parse_failed, and llvm::object::object_error::success.
|
virtual |
Implements llvm::object::ObjectFile.
Definition at line 600 of file COFFObjectFile.cpp.
References llvm::COFF::IMAGE_FILE_MACHINE_AMD64, llvm::COFF::IMAGE_FILE_MACHINE_I386, and llvm::object::coff_file_header::Machine.
error_code COFFObjectFile::getHeader | ( | const coff_file_header *& | Res | ) | const |
Definition at line 624 of file COFFObjectFile.cpp.
References getCOFFHeader().
error_code COFFObjectFile::getHintName | ( | uint32_t | Rva, |
uint16_t & | Hint, | ||
StringRef & | Name | ||
) | const |
Definition at line 415 of file COFFObjectFile.cpp.
References getRvaPtr(), and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 875 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 880 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
virtual |
For shared objects, returns the name which this object should be loaded from at runtime. This corresponds to DT_SONAME on ELF and LC_ID_DYLIB (install name) on MachO.
Implements llvm::object::ObjectFile.
Definition at line 560 of file COFFObjectFile.cpp.
error_code COFFObjectFile::getPE32Header | ( | const pe32_header *& | Res | ) | const |
Definition at line 633 of file COFFObjectFile.cpp.
References llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 770 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 763 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, llvm::object::ObjectFile::RelocationRef, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 774 of file COFFObjectFile.cpp.
References llvm::object::object_error::success, and llvm::object::coff_relocation::VirtualAddress.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 779 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, llvm::object::ObjectFile::SymbolRef, and llvm::object::coff_relocation::SymbolTableIndex.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 785 of file COFFObjectFile.cpp.
References llvm::object::object_error::success, and llvm::object::coff_relocation::Type.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 808 of file COFFObjectFile.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::StringRef::end(), llvm::COFF::IMAGE_FILE_MACHINE_AMD64, llvm::COFF::IMAGE_FILE_MACHINE_I386, llvm::COFF::IMAGE_REL_AMD64_ABSOLUTE, llvm::COFF::IMAGE_REL_AMD64_ADDR32, llvm::COFF::IMAGE_REL_AMD64_ADDR32NB, llvm::COFF::IMAGE_REL_AMD64_ADDR64, llvm::COFF::IMAGE_REL_AMD64_PAIR, llvm::COFF::IMAGE_REL_AMD64_REL32, llvm::COFF::IMAGE_REL_AMD64_REL32_1, llvm::COFF::IMAGE_REL_AMD64_REL32_2, llvm::COFF::IMAGE_REL_AMD64_REL32_3, llvm::COFF::IMAGE_REL_AMD64_REL32_4, llvm::COFF::IMAGE_REL_AMD64_REL32_5, llvm::COFF::IMAGE_REL_AMD64_SECREL, llvm::COFF::IMAGE_REL_AMD64_SECREL7, llvm::COFF::IMAGE_REL_AMD64_SECTION, llvm::COFF::IMAGE_REL_AMD64_SREL32, llvm::COFF::IMAGE_REL_AMD64_SSPAN32, llvm::COFF::IMAGE_REL_AMD64_TOKEN, llvm::COFF::IMAGE_REL_I386_ABSOLUTE, llvm::COFF::IMAGE_REL_I386_DIR16, llvm::COFF::IMAGE_REL_I386_DIR32, llvm::COFF::IMAGE_REL_I386_DIR32NB, llvm::COFF::IMAGE_REL_I386_REL16, llvm::COFF::IMAGE_REL_I386_REL32, llvm::COFF::IMAGE_REL_I386_SECREL, llvm::COFF::IMAGE_REL_I386_SECREL7, llvm::COFF::IMAGE_REL_I386_SECTION, llvm::COFF::IMAGE_REL_I386_SEG12, llvm::COFF::IMAGE_REL_I386_TOKEN, LLVM_COFF_SWITCH_RELOC_TYPE_NAME, llvm::object::coff_file_header::Machine, llvm::object::object_error::success, and llvm::object::coff_relocation::Type.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 862 of file COFFObjectFile.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::StringRef::end(), getSymbol(), getSymbolName(), llvm::object::DataRefImpl::p, llvm::object::object_error::success, and llvm::object::coff_relocation::SymbolTableIndex.
error_code COFFObjectFile::getRvaPtr | ( | uint32_t | Rva, |
uintptr_t & | Res | ||
) | const |
Definition at line 394 of file COFFObjectFile.cpp.
References llvm::object::ObjectFile::base(), begin_sections(), end_sections(), getCOFFSection(), llvm::object::content_iterator< content_type >::increment(), llvm::object::object_error::parse_failed, llvm::object::coff_section::PointerToRawData, llvm::ARMBuildAttrs::Section, llvm::object::object_error::success, llvm::object::coff_section::VirtualAddress, and llvm::object::coff_section::VirtualSize.
Referenced by getHintName(), llvm::object::ImportDirectoryEntryRef::getImportLookupEntry(), and llvm::object::ImportDirectoryEntryRef::getName().
error_code COFFObjectFile::getSection | ( | int32_t | index, |
const coff_section *& | Res | ||
) | const |
Definition at line 647 of file COFFObjectFile.cpp.
References llvm::COFF::IMAGE_SYM_ABSOLUTE, llvm::COFF::IMAGE_SYM_DEBUG, llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::object::object_error::parse_failed, and llvm::object::object_error::success.
Referenced by getSymbolAddress(), getSymbolFileOffset(), getSymbolSection(), getSymbolSize(), getSymbolType(), and sectionContainsSymbol().
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 245 of file COFFObjectFile.cpp.
References llvm::object::object_error::success, and llvm::object::coff_section::VirtualAddress.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 268 of file COFFObjectFile.cpp.
References llvm::object::coff_section::Characteristics, llvm::object::object_error::parse_failed, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
error_code llvm::object::COFFObjectFile::getSectionContents | ( | const coff_section * | Sec, |
ArrayRef< uint8_t > & | Res | ||
) | const |
|
protectedvirtual |
Implements llvm::object::ObjectFile.
error_code llvm::object::COFFObjectFile::getSectionName | ( | const coff_section * | Sec, |
StringRef & | Res | ||
) | const |
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 230 of file COFFObjectFile.cpp.
References llvm::object::DataRefImpl::p, llvm::object::ObjectFile::SectionRef, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 252 of file COFFObjectFile.cpp.
References llvm::object::coff_section::SizeOfRawData, and llvm::object::object_error::success.
error_code COFFObjectFile::getSymbol | ( | uint32_t | index, |
const coff_symbol *& | Res | ||
) | const |
Definition at line 673 of file COFFObjectFile.cpp.
References llvm::object::object_error::parse_failed, and llvm::object::object_error::success.
Referenced by getAuxSymbol(), and getRelocationValueString().
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 125 of file COFFObjectFile.cpp.
References getSection(), llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::ARMBuildAttrs::Section, llvm::object::coff_symbol::SectionNumber, llvm::object::object_error::success, llvm::object::UnknownAddressOrSize, llvm::object::coff_symbol::Value, and llvm::object::coff_section::VirtualAddress.
ArrayRef< uint8_t > COFFObjectFile::getSymbolAuxData | ( | const coff_symbol * | symbol | ) | const |
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 109 of file COFFObjectFile.cpp.
References getSection(), llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::object::coff_section::PointerToRawData, llvm::ARMBuildAttrs::Section, llvm::object::coff_symbol::SectionNumber, llvm::object::object_error::success, llvm::object::UnknownAddressOrSize, and llvm::object::coff_symbol::Value.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 167 of file COFFObjectFile.cpp.
References llvm::COFF::IMAGE_SYM_ABSOLUTE, llvm::COFF::IMAGE_SYM_CLASS_EXTERNAL, llvm::COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL, llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::object::coff_symbol::SectionNumber, llvm::object::coff_symbol::StorageClass, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Referenced by getRelocationValueString().
error_code llvm::object::COFFObjectFile::getSymbolName | ( | const coff_symbol * | symbol, |
StringRef & | Res | ||
) | const |
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 94 of file COFFObjectFile.cpp.
References llvm::object::coff_symbol::NumberOfAuxSymbols, llvm::object::DataRefImpl::p, llvm::object::object_error::success, and llvm::object::ObjectFile::SymbolRef.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 210 of file COFFObjectFile.cpp.
References end_sections(), getSection(), llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::object::DataRefImpl::p, llvm::object::coff_symbol::SectionNumber, llvm::object::ObjectFile::SectionRef, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 191 of file COFFObjectFile.cpp.
References getSection(), llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::ARMBuildAttrs::Section, llvm::object::coff_symbol::SectionNumber, llvm::object::coff_section::SizeOfRawData, llvm::object::object_error::success, llvm::object::UnknownAddressOrSize, and llvm::object::coff_symbol::Value.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 141 of file COFFObjectFile.cpp.
References Characteristics, llvm::object::coff_section::Characteristics, llvm::object::coff_symbol::getComplexType(), getSection(), llvm::COFF::IMAGE_SYM_CLASS_EXTERNAL, llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION, llvm::COFF::IMAGE_SYM_UNDEFINED, llvm::ARMBuildAttrs::Section, llvm::object::coff_symbol::SectionNumber, llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Other, llvm::object::SymbolRef::ST_Unknown, llvm::object::coff_symbol::StorageClass, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 225 of file COFFObjectFile.cpp.
References llvm::report_fatal_error().
import_directory_iterator COFFObjectFile::import_directory_begin | ( | ) | const |
Definition at line 565 of file COFFObjectFile.cpp.
References ImportDirectoryEntryRef, and llvm::object::DataRefImpl::p.
import_directory_iterator COFFObjectFile::import_directory_end | ( | ) | const |
Definition at line 571 of file COFFObjectFile.cpp.
References ImportDirectoryEntryRef, and llvm::object::DataRefImpl::p.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 291 of file COFFObjectFile.cpp.
References llvm::object::coff_section::Characteristics, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 284 of file COFFObjectFile.cpp.
References llvm::object::coff_section::Characteristics, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 319 of file COFFObjectFile.cpp.
References llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 298 of file COFFObjectFile.cpp.
References llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 277 of file COFFObjectFile.cpp.
References llvm::object::coff_section::Characteristics, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 305 of file COFFObjectFile.cpp.
References llvm::object::coff_section::Characteristics, and llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 312 of file COFFObjectFile.cpp.
References llvm::object::object_error::success.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 340 of file COFFObjectFile.cpp.
References llvm::object::ObjectFile::base(), llvm::object::coff_section::NumberOfRelocations, llvm::object::DataRefImpl::p, llvm::object::coff_section::PointerToRelocations, and llvm::object::ObjectFile::RelocationRef.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 351 of file COFFObjectFile.cpp.
References llvm::object::ObjectFile::base(), llvm::object::coff_section::NumberOfRelocations, llvm::object::DataRefImpl::p, llvm::object::coff_section::PointerToRelocations, and llvm::object::ObjectFile::RelocationRef.
|
protectedvirtual |
Implements llvm::object::ObjectFile.
Definition at line 326 of file COFFObjectFile.cpp.
References getSection(), llvm::object::coff_symbol::SectionNumber, and llvm::object::object_error::success.
|
friend |
Definition at line 225 of file Object/COFF.h.
Referenced by import_directory_begin(), and import_directory_end().