36 #include <system_error> 60 const uint64_t
Size =
sizeof(
T)) {
61 uintptr_t Addr = uintptr_t(Ptr);
64 Obj =
reinterpret_cast<const T *
>(Addr);
65 return std::error_code();
71 assert(Str.
size() <= 6 &&
"String too long, possible overflow.");
76 while (!Str.
empty()) {
78 if (Str[0] >=
'A' && Str[0] <=
'Z')
79 CharVal = Str[0] -
'A';
80 else if (Str[0] >=
'a' && Str[0] <=
'z')
81 CharVal = Str[0] -
'a' + 26;
82 else if (Str[0] >=
'0' && Str[0] <=
'9')
83 CharVal = Str[0] -
'0' + 52;
84 else if (Str[0] ==
'+')
86 else if (Str[0] ==
'/')
91 Value = (Value * 64) + CharVal;
98 Result =
static_cast<uint32_t>(Value);
102 template <
typename coff_symbol_type>
103 const coff_symbol_type *COFFObjectFile::toSymb(
DataRefImpl Ref)
const {
104 const coff_symbol_type *Addr =
105 reinterpret_cast<const coff_symbol_type *
>(Ref.
p);
110 uintptr_t
Offset = uintptr_t(Addr) - uintptr_t(
base());
113 "Symbol did not point to the beginning of a symbol");
127 uintptr_t
Offset = uintptr_t(Addr) - uintptr_t(SectionTable);
129 "Section did not point to the beginning of a section");
136 auto End =
reinterpret_cast<uintptr_t
>(StringTable);
140 Ref.
p = std::min(reinterpret_cast<uintptr_t>(Symb), End);
141 }
else if (SymbolTable32) {
144 Ref.
p = std::min(reinterpret_cast<uintptr_t>(Symb), End);
179 if (std::error_code EC =
getSection(SectionNumber, Section))
258 Ret.
p =
reinterpret_cast<uintptr_t
>(Sec);
270 Ref.
p =
reinterpret_cast<uintptr_t
>(Sec);
290 return toSec(Sec) - SectionTable;
353 if (Sec->hasExtendedRelocations()) {
354 const coff_relocation *FirstReloc;
355 if (
getObject(FirstReloc, M, reinterpret_cast<const coff_relocation*>(
356 base + Sec->PointerToRelocations)))
359 return FirstReloc->VirtualAddress - 1;
361 return Sec->NumberOfRelocations;
364 static const coff_relocation *
369 auto begin =
reinterpret_cast<const coff_relocation *
>(
370 Base + Sec->PointerToRelocations);
371 if (Sec->hasExtendedRelocations()) {
377 sizeof(coff_relocation) * NumRelocs))
388 Ret.
p =
reinterpret_cast<uintptr_t
>(
begin);
398 Ret.
p =
reinterpret_cast<uintptr_t
>(
I);
403 std::error_code COFFObjectFile::initSymbolTablePtr() {
410 if (COFFBigObjHeader)
421 const uint8_t *StringTableAddr =
base() + StringTableOffset;
423 if (std::error_code EC =
getObject(StringTableSizePtr,
Data, StringTableAddr))
425 StringTableSize = *StringTableSizePtr;
426 if (std::error_code EC =
427 getObject(StringTable,
Data, StringTableAddr, StringTableSize))
432 if (StringTableSize < 4)
436 if (StringTableSize > 4 && StringTable[StringTableSize - 1] != 0)
438 return std::error_code();
444 else if (PE32PlusHeader)
453 uint64_t Rva = Addr - ImageBase;
454 assert(Rva <= UINT32_MAX);
464 if (SectionStart <= Addr && Addr < SectionEnd) {
467 return std::error_code();
481 uint32_t OffsetIntoSection = RVA - SectionStart;
482 if (SectionStart <= RVA && OffsetIntoSection < Section->VirtualSize &&
483 Size <= Section->VirtualSize - OffsetIntoSection) {
488 return std::error_code();
498 uintptr_t IntPtr = 0;
499 if (std::error_code EC =
getRvaPtr(Rva, IntPtr))
501 const uint8_t *Ptr =
reinterpret_cast<const uint8_t *
>(IntPtr);
502 Hint = *
reinterpret_cast<const ulittle16_t *
>(Ptr);
503 Name =
StringRef(reinterpret_cast<const char *>(Ptr + 2));
504 return std::error_code();
515 if (InfoBytes.
size() <
sizeof(*PDBInfo) + 1)
518 InfoBytes = InfoBytes.
drop_front(
sizeof(*PDBInfo));
519 PDBFileName =
StringRef(reinterpret_cast<const char *>(InfoBytes.
data()),
522 PDBFileName = PDBFileName.
split(
'\0').first;
523 return std::error_code();
535 return std::error_code();
539 std::error_code COFFObjectFile::initImportTablePtr() {
544 return std::error_code();
548 return std::error_code();
554 uintptr_t IntPtr = 0;
555 if (std::error_code EC =
getRvaPtr(ImportTableRva, IntPtr))
559 ImportDirectory =
reinterpret_cast< 561 return std::error_code();
565 std::error_code COFFObjectFile::initDelayImportTablePtr() {
568 return std::error_code();
570 return std::error_code();
573 NumberOfDelayImportDirectory = DataEntry->
Size /
576 uintptr_t IntPtr = 0;
577 if (std::error_code EC =
getRvaPtr(RVA, IntPtr))
579 DelayImportDirectory =
reinterpret_cast< 581 return std::error_code();
585 std::error_code COFFObjectFile::initExportTablePtr() {
590 return std::error_code();
594 return std::error_code();
597 uintptr_t IntPtr = 0;
598 if (std::error_code EC =
getRvaPtr(ExportTableRva, IntPtr))
602 return std::error_code();
605 std::error_code COFFObjectFile::initBaseRelocPtr() {
608 return std::error_code();
610 return std::error_code();
612 uintptr_t IntPtr = 0;
618 IntPtr + DataEntry->
Size);
621 return std::error_code();
624 std::error_code COFFObjectFile::initDebugDirectoryPtr() {
628 return std::error_code();
632 return std::error_code();
638 uintptr_t IntPtr = 0;
641 DebugDirectoryBegin =
reinterpret_cast<const debug_directory *
>(IntPtr);
643 IntPtr + DataEntry->
Size);
646 return std::error_code();
649 std::error_code COFFObjectFile::initLoadConfigPtr() {
653 return std::error_code();
657 return std::error_code();
658 uintptr_t IntPtr = 0;
662 LoadConfig = (
const void *)IntPtr;
663 return std::error_code();
668 COFFBigObjHeader(nullptr), PE32Header(nullptr), PE32PlusHeader(nullptr),
669 DataDirectory(nullptr), SectionTable(nullptr), SymbolTable16(nullptr),
670 SymbolTable32(nullptr), StringTable(nullptr), StringTableSize(0),
671 ImportDirectory(nullptr),
672 DelayImportDirectory(nullptr), NumberOfDelayImportDirectory(0),
673 ExportDirectory(nullptr), BaseRelocHeader(nullptr), BaseRelocEnd(nullptr),
674 DebugDirectoryBegin(nullptr), DebugDirectoryEnd(nullptr) {
684 bool HasPEHeader =
false;
691 if (DH->Magic[0] ==
'M' && DH->Magic[1] ==
'Z') {
718 COFFHeader =
nullptr;
722 COFFBigObjHeader =
nullptr;
728 EC = std::error_code();
740 const uint8_t *DataDirAddr;
741 uint64_t DataDirSize;
755 if ((EC =
getObject(DataDirectory,
Data, DataDirAddr, DataDirSize)))
768 if ((EC = initSymbolTablePtr())) {
769 SymbolTable16 =
nullptr;
770 SymbolTable32 =
nullptr;
771 StringTable =
nullptr;
783 if ((EC = initImportTablePtr()))
785 if ((EC = initDelayImportTablePtr()))
789 if ((EC = initExportTablePtr()))
793 if ((EC = initBaseRelocPtr()))
797 if ((EC = initDebugDirectoryPtr()))
800 if ((EC = initLoadConfigPtr()))
803 EC = std::error_code();
815 Ret.
p =
reinterpret_cast<uintptr_t
>(StringTable);
820 if (!ImportDirectory)
822 if (ImportDirectory->
isNull())
843 DelayImportDirectory, NumberOfDelayImportDirectory,
this));
852 if (!ExportDirectory)
861 Ret.
p =
reinterpret_cast<uintptr_t
>(SectionTable);
869 Ret.
p =
reinterpret_cast<uintptr_t
>(SectionTable + NumSections);
890 return "COFF-x86-64";
896 return "COFF-<unknown arch>";
944 return std::error_code();
949 Res = COFFBigObjHeader;
950 return std::error_code();
955 return std::error_code();
960 Res = PE32PlusHeader;
961 return std::error_code();
968 if (!DataDirectory) {
972 assert(PE32Header || PE32PlusHeader);
975 if (Index >= NumEnt) {
979 Res = &DataDirectory[
Index];
980 return std::error_code();
987 return std::error_code();
990 Result = SectionTable + (Index - 1);
991 return std::error_code();
1001 if (std::error_code
E =
Section.getName(SecName))
1003 if (SecName == SectionName) {
1005 return std::error_code();
1013 if (StringTableSize <= 4)
1016 if (Offset >= StringTableSize)
1018 Result =
StringRef(StringTable + Offset);
1019 return std::error_code();
1033 return std::error_code();
1042 return std::error_code();
1047 const uint8_t *Aux =
nullptr;
1052 Aux =
reinterpret_cast<const uint8_t *
>(Symbol.
getRawPtr()) + SymbolSize;
1055 uintptr_t Offset = uintptr_t(Aux) - uintptr_t(
base());
1062 "Aux Symbol data did not point to the beginning of a symbol");
1072 "Symbol did not point to the beginning of a symbol");
1098 if (std::error_code EC = getString(Offset, Name))
1103 return std::error_code();
1128 return std::error_code();
1136 Res =
makeArrayRef(reinterpret_cast<const uint8_t *>(ConStart), SectionSize);
1137 return std::error_code();
1145 Rel.
p =
reinterpret_cast<uintptr_t
>(
1161 else if (SymbolTable32)
1180 return toSymb<coff_symbol16>(Ref);
1182 return toSymb<coff_symbol32>(Ref);
1201 #define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type) \ 1202 case COFF::reloc_type: \ 1296 #undef LLVM_COFF_SWITCH_RELOC_TYPE_NAME 1306 return !DataDirectory;
1311 .Case(
"eh_fram",
"eh_frame")
1317 return ImportTable == Other.ImportTable && Index == Other.Index;
1322 if (ImportTable[Index].isNull()) {
1324 ImportTable =
nullptr;
1330 return getObject(Result, OwningObject->Data, ImportTable + Index);
1335 uintptr_t Ptr,
int Index) {
1336 if (Object->getBytesInAddress() == 4) {
1346 uintptr_t IntPtr = 0;
1347 Object->getRvaPtr(RVA, IntPtr);
1353 uintptr_t IntPtr = 0;
1354 Object->getRvaPtr(RVA, IntPtr);
1357 if (Object->getBytesInAddress() == 4) {
1358 auto *Entry =
reinterpret_cast<ulittle32_t *
>(IntPtr);
1362 auto *Entry =
reinterpret_cast<ulittle64_t *
>(IntPtr);
1383 return make_range(imported_symbol_begin(), imported_symbol_end());
1398 return make_range(lookup_table_begin(), lookup_table_end());
1402 uintptr_t IntPtr = 0;
1403 if (std::error_code EC =
1404 OwningObject->getRvaPtr(ImportTable[Index].NameRVA, IntPtr))
1406 Result =
StringRef(reinterpret_cast<const char *>(IntPtr));
1407 return std::error_code();
1412 Result = ImportTable[
Index].ImportLookupTableRVA;
1413 return std::error_code();
1418 Result = ImportTable[
Index].ImportAddressTableRVA;
1419 return std::error_code();
1424 return Table == Other.Table && Index == Other.Index;
1445 return make_range(imported_symbol_begin(), imported_symbol_end());
1449 uintptr_t IntPtr = 0;
1450 if (std::error_code EC = OwningObject->getRvaPtr(Table[Index].Name, IntPtr))
1452 Result =
StringRef(reinterpret_cast<const char *>(IntPtr));
1453 return std::error_code();
1459 return std::error_code();
1465 AddrIndex * (OwningObject->is64() ? 8 : 4);
1466 uintptr_t IntPtr = 0;
1467 if (std::error_code EC = OwningObject->getRvaPtr(RVA, IntPtr))
1469 if (OwningObject->is64())
1470 Result = *reinterpret_cast<const ulittle64_t *>(IntPtr);
1472 Result = *
reinterpret_cast<const ulittle32_t *
>(IntPtr);
1473 return std::error_code();
1478 return ExportTable == Other.ExportTable && Index == Other.Index;
1488 uintptr_t IntPtr = 0;
1489 if (std::error_code EC =
1490 OwningObject->getRvaPtr(ExportTable->NameRVA, IntPtr))
1492 Result =
StringRef(reinterpret_cast<const char *>(IntPtr));
1493 return std::error_code();
1499 Result = ExportTable->OrdinalBase;
1500 return std::error_code();
1505 Result = ExportTable->OrdinalBase +
Index;
1506 return std::error_code();
1511 uintptr_t IntPtr = 0;
1512 if (std::error_code EC =
1513 OwningObject->getRvaPtr(ExportTable->ExportAddressTableRVA, IntPtr))
1518 return std::error_code();
1525 uintptr_t IntPtr = 0;
1526 if (std::error_code EC =
1527 OwningObject->getRvaPtr(ExportTable->OrdinalTableRVA, IntPtr))
1531 uint32_t NumEntries = ExportTable->NumberOfNamePointers;
1537 if (std::error_code EC =
1538 OwningObject->getRvaPtr(ExportTable->NamePointerRVA, IntPtr))
1541 if (std::error_code EC = OwningObject->getRvaPtr(NamePtr[Offset], IntPtr))
1543 Result =
StringRef(reinterpret_cast<const char *>(IntPtr));
1544 return std::error_code();
1547 return std::error_code();
1555 if (
auto EC = getExportRVA(RVA))
1559 Result = (Begin <= RVA && RVA < End);
1560 return std::error_code();
1565 if (
auto EC = getExportRVA(RVA))
1567 uintptr_t IntPtr = 0;
1568 if (
auto EC = OwningObject->getRvaPtr(RVA, IntPtr))
1570 Result =
StringRef(reinterpret_cast<const char *>(IntPtr));
1571 return std::error_code();
1576 return Entry32 == Other.Entry32 && Entry64 == Other.Entry64
1577 && Index == Other.Index;
1589 if (Entry32[Index].isOrdinal())
1590 return std::error_code();
1591 RVA = Entry32[
Index].getHintNameRVA();
1593 if (Entry64[Index].isOrdinal())
1594 return std::error_code();
1595 RVA = Entry64[
Index].getHintNameRVA();
1597 uintptr_t IntPtr = 0;
1598 if (std::error_code EC = OwningObject->getRvaPtr(RVA, IntPtr))
1601 Result =
StringRef(reinterpret_cast<const char *>(IntPtr + 2));
1602 return std::error_code();
1607 Result = Entry32[
Index].isOrdinal();
1609 Result = Entry64[
Index].isOrdinal();
1610 return std::error_code();
1615 Result = Entry32[
Index].getHintNameRVA();
1617 Result = Entry64[
Index].getHintNameRVA();
1618 return std::error_code();
1624 if (Entry32[Index].isOrdinal()) {
1625 Result = Entry32[
Index].getOrdinal();
1626 return std::error_code();
1628 RVA = Entry32[
Index].getHintNameRVA();
1630 if (Entry64[Index].isOrdinal()) {
1631 Result = Entry64[
Index].getOrdinal();
1632 return std::error_code();
1634 RVA = Entry64[
Index].getHintNameRVA();
1636 uintptr_t IntPtr = 0;
1637 if (std::error_code EC = OwningObject->getRvaPtr(RVA, IntPtr))
1639 Result = *
reinterpret_cast<const ulittle16_t *
>(IntPtr);
1640 return std::error_code();
1649 return std::move(Ret);
1653 return Header == Other.Header && Index == Other.Index;
1661 if (Size == Header->BlockSize) {
1667 reinterpret_cast<const uint8_t *
>(Header) + Size);
1677 return std::error_code();
1682 Result = Header->PageRVA + Entry[
Index].getOffset();
1683 return std::error_code();
1686 #define RETURN_IF_ERROR(E) \ 1691 ResourceSectionRef::getDirStringAtOffset(
uint32_t Offset) {
1698 return RawDirString;
1703 return getDirStringAtOffset(Entry.
Identifier.getNameOffset());
1707 ResourceSectionRef::getTableAtOffset(
uint32_t Offset) {
1713 assert(Table !=
nullptr);
1719 return getTableAtOffset(Entry.
Offset.value());
1723 return getTableAtOffset(0);
uint32_t getAlignment() const
static uint32_t getNumberOfRelocations(const coff_section *Sec, MemoryBufferRef M, const uint8_t *base)
std::error_code getHintNameRVA(uint32_t &Result) const
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
std::error_code getImportAddress(int AddrIndex, uint64_t &Result) const
section_iterator section_begin() const override
std::error_code getType(uint8_t &Type) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
const coff_section * getCOFFSection(const SectionRef &Section) const
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
COFFObjectFile(MemoryBufferRef Object, std::error_code &EC)
uint64_t getRelocationOffset(DataRefImpl Rel) const override
support::ulittle32_t VirtualAddress
bool operator==(const DelayImportDirectoryEntryRef &Other) const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
void moveSectionNext(DataRefImpl &Sec) const override
static std::error_code getObject(const T *&Obj, MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
COFFSymbolRef getCOFFSymbol(const DataRefImpl &Ref) const
static std::error_code checkOffset(MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
export_directory_iterator export_directory_end() const
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
std::error_code getSection(int32_t index, const coff_section *&Res) const
std::error_code getOrdinal(uint32_t &Result) const
base_reloc_iterator base_reloc_end() const
void moveRelocationNext(DataRefImpl &Rel) const override
This class is the base class for all object file types.
content_iterator< DelayImportDirectoryEntryRef > delay_import_directory_iterator
uint32_t getPointerToSymbolTable() const
static const coff_relocation * getFirstReloc(const coff_section *Sec, MemoryBufferRef M, const uint8_t *Base)
iterator_range< imported_symbol_iterator > imported_symbols() const
bool isSectionDefinition() const
uint64_t getImageBase() const
bool isSectionCompressed(DataRefImpl Sec) const override
const uint8_t * base() const
uint8_t getNumberOfAuxSymbols() const
export_directory_iterator export_directory_begin() const
std::error_code getName(StringRef &Result) const
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
std::error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const override
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const override
static const char BigObjMagic[]
const coff_relocation * getCOFFRelocation(const RelocationRef &Reloc) const
import_directory_iterator import_directory_begin() const
iterator_range< const debug_directory * > debug_directories() const
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
basic_symbol_iterator symbol_end() const override
detail::packed_endian_specific_integral< uint64_t, little, unaligned > ulittle64_t
std::error_code getCOFFHeader(const coff_file_header *&Res) const
char ShortName[COFF::NameSize]
amdgpu Simplify well known AMD library false Value Value const Twine & Name
friend class ExportDirectoryEntryRef
uint64_t getSectionAlignment(DataRefImpl Sec) const override
char Name[COFF::NameSize]
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
DataRefImpl getRawDataRefImpl() const
This is a value type class that represents a single relocation in the list of relocations in the obje...
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
The access may reference the value stored in memory.
iterator_range< base_reloc_iterator > base_relocs() const
Tagged union holding either a T or a Error.
union llvm::object::coff_symbol_generic::@274 Name
static imported_symbol_iterator importedSymbolBegin(uint32_t RVA, const COFFObjectFile *Object)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
bool isReservedSectionNumber(int32_t SectionNumber)
imported_symbol_iterator lookup_table_begin() const
std::error_code getRvaAndSizeAsBytes(uint32_t RVA, uint32_t Size, ArrayRef< uint8_t > &Contents) const
Given an RVA base and size, returns a valid array of bytes or an error code if the RVA and size is no...
support::ulittle32_t VirtualSize
#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type)
content_iterator< SectionRef > section_iterator
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
iterator_range< imported_symbol_iterator > imported_symbols() const
imported_symbol_iterator imported_symbol_end() const
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
int32_t getSectionNumber() const
uint32_t getSymbolFlags(DataRefImpl Symb) const override
std::error_code getDllName(StringRef &Result) const
union llvm::object::coff_resource_dir_entry::@275 Identifier
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
uint64_t getSectionAddress(DataRefImpl Sec) const override
section_iterator_range sections() const
void moveSymbolNext(DataRefImpl &Symb) const override
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
uint8_t getComplexType() const
support::ulittle32_t ExportRVA
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
std::error_code getRVA(uint32_t &Result) const
static bool checkSize(MemoryBufferRef M, std::error_code &EC, uint64_t Size)
relocation_iterator section_rel_end(DataRefImpl Sec) const override
std::error_code getDelayImportTable(const delay_import_directory_table_entry *&Result) const
support::ulittle32_t Characteristics
A switch()-like statement whose cases are string literals.
base_reloc_iterator base_reloc_begin() const
std::error_code getName(StringRef &Result) const
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
content_iterator< ExportDirectoryEntryRef > export_directory_iterator
size_t getBufferSize() const
delay_import_directory_iterator delay_import_directory_end() const
The instances of the Type class are immutable: once they are created, they are never changed...
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
bool operator==(const BaseRelocRef &Other) const
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
const dos_header * getDOSHeader() const
content_iterator< ImportedSymbolRef > imported_symbol_iterator
std::error_code getOrdinal(uint16_t &Result) const
import_lookup_table_entry< support::little64_t > import_lookup_table_entry64
std::error_code getHintName(uint32_t Rva, uint16_t &Hint, StringRef &Name) const
bool operator==(const ImportedSymbolRef &Other) const
delay_import_directory_iterator delay_import_directory_begin() const
support::ulittle32_t RelativeVirtualAddress
content_iterator< ImportDirectoryEntryRef > import_directory_iterator
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
std::error_code isForwarder(bool &Result) const
std::error_code getSymbolName(StringRef &Result) const
imported_symbol_iterator imported_symbol_begin() const
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
const void * getRawPtr() const
support::ulittle16_t Type
std::error_code getDebugPDBInfo(const debug_directory *DebugDir, const codeview::DebugInfo *&Info, StringRef &PDBFileName) const
Get PDB information out of a codeview debug directory entry.
const coff_symbol_generic * getGeneric() const
static imported_symbol_iterator makeImportedSymbolIterator(const COFFObjectFile *Object, uintptr_t Ptr, int Index)
support::ulittle32_t SizeOfRawData
uint64_t getRelocationType(DataRefImpl Rel) const override
std::error_code getPE32Header(const pe32_header *&Res) const
std::error_code getOrdinalBase(uint32_t &Result) const
StringRef getFileFormatName() const override
DataRefImpl getRawDataRefImpl() const
unsigned getSectionID(SectionRef Sec) const
support::ulittle32_t VirtualAddress
support::ulittle32_t SymbolTableIndex
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef getRelocationTypeName(uint16_t Type) const
import_directory_iterator import_directory_end() const
uint16_t getMachine() const
friend class ImportDirectoryEntryRef
std::error_code isOrdinal(bool &Result) const
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
const coff_aux_weak_external * getWeakExternal() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
imported_symbol_iterator imported_symbol_begin() const
void setOffset(uint32_t Off)
support::ulittle32_t PointerToRawData
friend class RelocationRef
iterator_range< import_directory_iterator > import_directories() const
static Expected< std::unique_ptr< COFFObjectFile > > createCOFFObjectFile(MemoryBufferRef Object)
Expected< const coff_resource_dir_table & > getEntrySubDir(const coff_resource_dir_entry &Entry)
uint32_t getNumberOfSections() const
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
Expected< ArrayRef< UTF16 > > getEntryNameString(const coff_resource_dir_entry &Entry)
basic_symbol_iterator symbol_begin() const override
static bool decodeBase64StringEntry(StringRef Str, uint32_t &Result)
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool isSectionData(DataRefImpl Sec) const override
uint64_t getSymbolValue(DataRefImpl Symb) const
std::error_code getForwardTo(StringRef &Result) const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
std::error_code getVaPtr(uint64_t VA, uintptr_t &Res) const
content_iterator< BasicSymbolRef > basic_symbol_iterator
union llvm::object::coff_resource_dir_entry::@276 Offset
std::error_code getExportRVA(uint32_t &Result) const
A range adaptor for a pair of iterators.
std::error_code getRvaPtr(uint32_t Rva, uintptr_t &Res) const
section_iterator section_end() const override
support::ulittle32_t AddressOfRawData
size_t getSymbolTableEntrySize() const
Expected< uint64_t > getStartAddress() const override
support::ulittle32_t Size
std::error_code getDataDirectory(uint32_t index, const data_directory *&Res) const
Triple::ArchType getArch() const override
This is a value type class that represents a single symbol in the list of symbols in the object file...
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
support::ulittle32_t Zeroes
StringRef mapDebugSectionName(StringRef Name) const override
Maps a debug section name to a standard DWARF section name.
ArrayRef< coff_relocation > getRelocations(const coff_section *Sec) const
bool operator==(const ExportDirectoryEntryRef &Other) const
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
bool isWeakExternal() const
bool isSectionText(DataRefImpl Sec) const override
std::error_code getCOFFBigObjHeader(const coff_bigobj_file_header *&Res) const
Merge contiguous icmps into a memcmp
std::error_code getImportTableEntry(const coff_import_directory_table_entry *&Result) const
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
Expected< const coff_resource_dir_table & > getBaseTable()
detail::packed_endian_specific_integral< int16_t, little, unaligned > little16_t
support::ulittle32_t AddressTableEntries
iterator_range< export_directory_iterator > export_directories() const
static const char PEMagic[]
bool isAnyUndefined() const
bool isSectionVirtual(DataRefImpl Sec) const override
static imported_symbol_iterator importedSymbolEnd(uint32_t RVA, const COFFObjectFile *Object)
ArrayRef< uint8_t > getSymbolAuxData(COFFSymbolRef Symbol) const
uint64_t getSectionSize(DataRefImpl Sec) const override
iterator_range< imported_symbol_iterator > lookup_table_symbols() const
uint8_t NumberOfAuxSymbols
support::ulittle32_t SizeOfData
bool isSectionBSS(DataRefImpl Sec) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uintptr_t getSymbolTable() const
bool isFileRecord() const
LLVM Value Representation.
content_iterator< BaseRelocRef > base_reloc_iterator
imported_symbol_iterator imported_symbol_end() const
content_iterator< RelocationRef > relocation_iterator
import_lookup_table_entry< support::little32_t > import_lookup_table_entry32
std::error_code getImportAddressTableRVA(uint32_t &Result) const
uint32_t getValue() const
print Instructions which execute on loop entry
#define RETURN_IF_ERROR(E)
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
bool operator==(const ImportDirectoryEntryRef &Other) const
std::error_code getImportLookupTableRVA(uint32_t &Result) const
std::error_code getPE32PlusHeader(const pe32plus_header *&Res) const
uint32_t getSymbolIndex(COFFSymbolRef Symbol) const
imported_symbol_iterator lookup_table_end() const
uint64_t getSectionIndex(DataRefImpl Sec) const override
unsigned getSymbolSectionID(SymbolRef Sym) const
DataRefImpl getRawDataRefImpl() const
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
std::error_code getSymbolName(StringRef &Result) const
iterator_range< delay_import_directory_iterator > delay_import_directories() const
This is a value type class that represents a single section in the list of sections in the object fil...
uint64_t PowerOf2Ceil(uint64_t A)
Returns the power of two which is greater than or equal to the given value.
uint32_t getNumberOfSymbols() const
support::ulittle32_t Offset
A function that returns a base type.