Lines Matching defs:const

57 static Error getObject(const T *&Obj, MemoryBufferRef M, const void *Ptr,
58 const uint64_t Size = sizeof(T)) {
62 Obj = reinterpret_cast<const T *>(Addr);
101 const coff_symbol_type *COFFObjectFile::toSymb(DataRefImpl Ref) const {
102 const coff_symbol_type *Addr =
103 reinterpret_cast<const coff_symbol_type *>(Ref.p);
118 const coff_section *COFFObjectFile::toSec(DataRefImpl Ref) const {
119 const coff_section *Addr = reinterpret_cast<const coff_section*>(Ref.p);
135 void COFFObjectFile::moveSymbolNext(DataRefImpl &Ref) const {
138 const coff_symbol16 *Symb = toSymb<coff_symbol16>(Ref);
142 const coff_symbol32 *Symb = toSymb<coff_symbol32>(Ref);
150 Expected<StringRef> COFFObjectFile::getSymbolName(DataRefImpl Ref) const {
154 uint64_t COFFObjectFile::getSymbolValueImpl(DataRefImpl Ref) const {
158 uint32_t COFFObjectFile::getSymbolAlignment(DataRefImpl Ref) const {
165 Expected<uint64_t> COFFObjectFile::getSymbolAddress(DataRefImpl Ref) const {
174 Expected<const coff_section *> Section = getSection(SectionNumber);
186 Expected<SymbolRef::Type> COFFObjectFile::getSymbolType(DataRefImpl Ref) const {
209 Expected<uint32_t> COFFObjectFile::getSymbolFlags(DataRefImpl Ref) const {
216 if (const coff_aux_weak_external *AWE = Symb.getWeakExternal()) {
240 uint64_t COFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Ref) const {
246 COFFObjectFile::getSymbolSection(DataRefImpl Ref) const {
250 Expected<const coff_section *> Sec = getSection(Symb.getSectionNumber());
258 unsigned COFFObjectFile::getSymbolSectionID(SymbolRef Sym) const {
263 void COFFObjectFile::moveSectionNext(DataRefImpl &Ref) const {
264 const coff_section *Sec = toSec(Ref);
269 Expected<StringRef> COFFObjectFile::getSectionName(DataRefImpl Ref) const {
270 const coff_section *Sec = toSec(Ref);
274 uint64_t COFFObjectFile::getSectionAddress(DataRefImpl Ref) const {
275 const coff_section *Sec = toSec(Ref);
284 uint64_t COFFObjectFile::getSectionIndex(DataRefImpl Sec) const {
288 uint64_t COFFObjectFile::getSectionSize(DataRefImpl Ref) const {
293 COFFObjectFile::getSectionContents(DataRefImpl Ref) const {
294 const coff_section *Sec = toSec(Ref);
301 uint64_t COFFObjectFile::getSectionAlignment(DataRefImpl Ref) const {
302 const coff_section *Sec = toSec(Ref);
306 bool COFFObjectFile::isSectionCompressed(DataRefImpl Sec) const {
310 bool COFFObjectFile::isSectionText(DataRefImpl Ref) const {
311 const coff_section *Sec = toSec(Ref);
315 bool COFFObjectFile::isSectionData(DataRefImpl Ref) const {
316 const coff_section *Sec = toSec(Ref);
320 bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {
321 const coff_section *Sec = toSec(Ref);
322 const uint32_t BssFlags = COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
330 bool COFFObjectFile::isDebugSection(DataRefImpl Ref) const {
341 unsigned COFFObjectFile::getSectionID(SectionRef Sec) const {
348 bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const {
349 const coff_section *Sec = toSec(Ref);
355 static uint32_t getNumberOfRelocations(const coff_section *Sec,
356 MemoryBufferRef M, const uint8_t *base) {
362 const coff_relocation *FirstReloc;
364 reinterpret_cast<const coff_relocation *>(
375 static const coff_relocation *
376 getFirstReloc(const coff_section *Sec, MemoryBufferRef M, const uint8_t *Base) {
380 auto begin = reinterpret_cast<const coff_relocation *>(
395 relocation_iterator COFFObjectFile::section_rel_begin(DataRefImpl Ref) const {
396 const coff_section *Sec = toSec(Ref);
397 const coff_relocation *begin = getFirstReloc(Sec, Data, base());
405 relocation_iterator COFFObjectFile::section_rel_end(DataRefImpl Ref) const {
406 const coff_section *Sec = toSec(Ref);
407 const coff_relocation *I = getFirstReloc(Sec, Data, base());
434 const uint8_t *StringTableAddr = base() + StringTableOffset;
435 const ulittle32_t *StringTableSizePtr;
454 uint64_t COFFObjectFile::getImageBase() const {
464 Error COFFObjectFile::getVaPtr(uint64_t Addr, uintptr_t &Res) const {
473 const char *ErrorContext) const {
474 for (const SectionRef &S : sections()) {
475 const coff_section *Section = getCOFFSection(S);
508 const char *ErrorContext) const {
509 for (const SectionRef &S : sections()) {
510 const coff_section *Section = getCOFFSection(S);
520 ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Begin), Size);
535 StringRef &Name) const {
539 const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(IntPtr);
540 Hint = *reinterpret_cast<const ulittle16_t *>(Ptr);
541 Name = StringRef(reinterpret_cast<const char *>(Ptr + 2));
545 Error COFFObjectFile::getDebugPDBInfo(const debug_directory *DebugDir,
546 const codeview::DebugInfo *&PDBInfo,
547 StringRef &PDBFileName) const {
555 PDBInfo = reinterpret_cast<const codeview::DebugInfo *>(InfoBytes.data());
557 PDBFileName = StringRef(reinterpret_cast<const char *>(InfoBytes.data()),
564 Error COFFObjectFile::getDebugPDBInfo(const codeview::DebugInfo *&PDBInfo,
565 StringRef &PDBFileName) const {
566 for (const debug_directory &D : debug_directories())
579 const data_directory *DataEntry = getDataDirectory(COFF::IMPORT_TABLE);
597 const coff_import_directory_table_entry *>(IntPtr);
603 const data_directory *DataEntry =
621 const delay_import_directory_table_entry *>(IntPtr);
629 const data_directory *DataEntry = getDataDirectory(COFF::EXPORT_TABLE);
645 reinterpret_cast<const export_directory_table_entry *>(IntPtr);
650 const data_directory *DataEntry =
664 BaseRelocHeader = reinterpret_cast<const coff_base_reloc_block_header *>(
675 const data_directory *DataEntry = getDataDirectory(COFF::DEBUG_DIRECTORY);
695 DebugDirectoryBegin = reinterpret_cast<const debug_directory *>(IntPtr);
696 DebugDirectoryEnd = reinterpret_cast<const debug_directory *>(
705 const data_directory *DataEntry = getDataDirectory(COFF::TLS_TABLE);
731 TLSDirectory64 = reinterpret_cast<const coff_tls_directory64 *>(IntPtr);
733 TLSDirectory32 = reinterpret_cast<const coff_tls_directory32 *>(IntPtr);
740 const data_directory *DataEntry = getDataDirectory(COFF::LOAD_CONFIG_TABLE);
754 LoadConfig = (const void *)IntPtr;
769 CHPEMetadata = reinterpret_cast<const chpe_metadata *>(IntPtr);
850 const auto *DH = reinterpret_cast<const dos_header *>(base());
896 const pe32_header *Header;
900 const uint8_t *DataDirAddr;
907 PE32PlusHeader = reinterpret_cast<const pe32plus_header *>(Header);
975 basic_symbol_iterator COFFObjectFile::symbol_begin() const {
981 basic_symbol_iterator COFFObjectFile::symbol_end() const {
988 import_directory_iterator COFFObjectFile::import_directory_begin() const {
997 import_directory_iterator COFFObjectFile::import_directory_end() const {
1003 COFFObjectFile::delay_import_directory_begin() const {
1009 COFFObjectFile::delay_import_directory_end() const {
1015 export_directory_iterator COFFObjectFile::export_directory_begin() const {
1020 export_directory_iterator COFFObjectFile::export_directory_end() const {
1028 section_iterator COFFObjectFile::section_begin() const {
1034 section_iterator COFFObjectFile::section_end() const {
1042 base_reloc_iterator COFFObjectFile::base_reloc_begin() const {
1046 base_reloc_iterator COFFObjectFile::base_reloc_end() const {
1050 uint8_t COFFObjectFile::getBytesInAddress() const {
1054 StringRef COFFObjectFile::getFileFormatName() const {
1073 Triple::ArchType COFFObjectFile::getArch() const {
1077 Expected<uint64_t> COFFObjectFile::getStartAddress() const {
1084 COFFObjectFile::import_directories() const {
1089 COFFObjectFile::delay_import_directories() const {
1095 COFFObjectFile::export_directories() const {
1099 iterator_range<base_reloc_iterator> COFFObjectFile::base_relocs() const {
1103 const data_directory *COFFObjectFile::getDataDirectory(uint32_t Index) const {
1114 Expected<const coff_section *> COFFObjectFile::getSection(int32_t Index) const {
1118 return (const coff_section *)nullptr;
1127 Expected<StringRef> COFFObjectFile::getString(uint32_t Offset) const {
1136 Expected<StringRef> COFFObjectFile::getSymbolName(COFFSymbolRef Symbol) const {
1141 COFFObjectFile::getSymbolName(const coff_symbol_generic *Symbol) const {
1155 COFFObjectFile::getSymbolAuxData(COFFSymbolRef Symbol) const {
1156 const uint8_t *Aux = nullptr;
1161 Aux = reinterpret_cast<const uint8_t *>(Symbol.getRawPtr()) + SymbolSize;
1177 uint32_t COFFObjectFile::getSymbolIndex(COFFSymbolRef Symbol) const {
1188 COFFObjectFile::getSectionName(const coff_section *Sec) const {
1209 uint64_t COFFObjectFile::getSectionSize(const coff_section *Sec) const {
1225 Error COFFObjectFile::getSectionContents(const coff_section *Sec,
1226 ArrayRef<uint8_t> &Res) const {
1239 Res = ArrayRef(reinterpret_cast<const uint8_t *>(ConStart), SectionSize);
1243 const coff_relocation *COFFObjectFile::toRel(DataRefImpl Rel) const {
1244 return reinterpret_cast<const coff_relocation*>(Rel.p);
1247 void COFFObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
1249 reinterpret_cast<const coff_relocation*>(Rel.p) + 1);
1252 uint64_t COFFObjectFile::getRelocationOffset(DataRefImpl Rel) const {
1253 const coff_relocation *R = toRel(Rel);
1257 symbol_iterator COFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const {
1258 const coff_relocation *R = toRel(Rel);
1271 uint64_t COFFObjectFile::getRelocationType(DataRefImpl Rel) const {
1272 const coff_relocation* R = toRel(Rel);
1276 const coff_section *
1277 COFFObjectFile::getCOFFSection(const SectionRef &Section) const {
1281 COFFSymbolRef COFFObjectFile::getCOFFSymbol(const DataRefImpl &Ref) const {
1289 COFFSymbolRef COFFObjectFile::getCOFFSymbol(const SymbolRef &Symbol) const {
1293 const coff_relocation *
1294 COFFObjectFile::getCOFFRelocation(const RelocationRef &Reloc) const {
1299 COFFObjectFile::getRelocations(const coff_section *Sec) const {
1308 StringRef COFFObjectFile::getRelocationTypeName(uint16_t Type) const {
1405 DataRefImpl Rel, SmallVectorImpl<char> &Result) const {
1406 const coff_relocation *Reloc = toRel(Rel);
1411 bool COFFObjectFile::isRelocatableObject() const {
1415 StringRef COFFObjectFile::mapDebugSectionName(StringRef Name) const {
1422 operator==(const ImportDirectoryEntryRef &Other) const {
1435 const coff_import_directory_table_entry *&Result) const {
1440 makeImportedSymbolIterator(const COFFObjectFile *Object,
1443 auto *P = reinterpret_cast<const import_lookup_table_entry32 *>(Ptr);
1446 auto *P = reinterpret_cast<const import_lookup_table_entry64 *>(Ptr);
1451 importedSymbolBegin(uint32_t RVA, const COFFObjectFile *Object) {
1459 importedSymbolEnd(uint32_t RVA, const COFFObjectFile *Object) {
1478 ImportDirectoryEntryRef::imported_symbol_begin() const {
1484 ImportDirectoryEntryRef::imported_symbol_end() const {
1490 ImportDirectoryEntryRef::imported_symbols() const {
1494 imported_symbol_iterator ImportDirectoryEntryRef::lookup_table_begin() const {
1499 imported_symbol_iterator ImportDirectoryEntryRef::lookup_table_end() const {
1505 ImportDirectoryEntryRef::lookup_table_symbols() const {
1509 Error ImportDirectoryEntryRef::getName(StringRef &Result) const {
1514 Result = StringRef(reinterpret_cast<const char *>(IntPtr));
1519 ImportDirectoryEntryRef::getImportLookupTableRVA(uint32_t &Result) const {
1525 uint32_t &Result) const {
1531 operator==(const DelayImportDirectoryEntryRef &Other) const {
1540 DelayImportDirectoryEntryRef::imported_symbol_begin() const {
1546 DelayImportDirectoryEntryRef::imported_symbol_end() const {
1552 DelayImportDirectoryEntryRef::imported_symbols() const {
1556 Error DelayImportDirectoryEntryRef::getName(StringRef &Result) const {
1561 Result = StringRef(reinterpret_cast<const char *>(IntPtr));
1566 const delay_import_directory_table_entry *&Result) const {
1572 uint64_t &Result) const {
1579 Result = *reinterpret_cast<const ulittle64_t *>(IntPtr);
1581 Result = *reinterpret_cast<const ulittle32_t *>(IntPtr);
1586 operator==(const ExportDirectoryEntryRef &Other) const {
1596 Error ExportDirectoryEntryRef::getDllName(StringRef &Result) const {
1601 Result = StringRef(reinterpret_cast<const char *>(IntPtr));
1606 Error ExportDirectoryEntryRef::getOrdinalBase(uint32_t &Result) const {
1612 Error ExportDirectoryEntryRef::getOrdinal(uint32_t &Result) const {
1618 Error ExportDirectoryEntryRef::getExportRVA(uint32_t &Result) const {
1623 const export_address_table_entry *entry =
1624 reinterpret_cast<const export_address_table_entry *>(IntPtr);
1632 ExportDirectoryEntryRef::getSymbolName(StringRef &Result) const {
1637 const ulittle16_t *Start = reinterpret_cast<const ulittle16_t *>(IntPtr);
1641 for (const ulittle16_t *I = Start, *E = Start + NumEntries;
1648 const ulittle32_t *NamePtr = reinterpret_cast<const ulittle32_t *>(IntPtr);
1652 Result = StringRef(reinterpret_cast<const char *>(IntPtr));
1659 Error ExportDirectoryEntryRef::isForwarder(bool &Result) const {
1660 const data_directory *DataEntry =
1674 Error ExportDirectoryEntryRef::getForwardTo(StringRef &Result) const {
1681 Result = StringRef(reinterpret_cast<const char *>(IntPtr));
1686 operator==(const ImportedSymbolRef &Other) const {
1695 Error ImportedSymbolRef::getSymbolName(StringRef &Result) const {
1711 Result = StringRef(reinterpret_cast<const char *>(IntPtr + 2));
1715 Error ImportedSymbolRef::isOrdinal(bool &Result) const {
1723 Error ImportedSymbolRef::getHintNameRVA(uint32_t &Result) const {
1731 Error ImportedSymbolRef::getOrdinal(uint16_t &Result) const {
1749 Result = *reinterpret_cast<const ulittle16_t *>(IntPtr);
1758 bool BaseRelocRef::operator==(const BaseRelocRef &Other) const {
1772 Header = reinterpret_cast<const coff_base_reloc_block_header *>(
1773 reinterpret_cast<const uint8_t *>(Header) + Size);
1780 Error BaseRelocRef::getType(uint8_t &Type) const {
1781 auto *Entry = reinterpret_cast<const coff_base_reloc_block_entry *>(Header + 1);
1786 Error BaseRelocRef::getRVA(uint32_t &Result) const {
1787 auto *Entry = reinterpret_cast<const coff_base_reloc_block_entry *>(Header + 1);
1811 ResourceSectionRef::getEntryNameString(const coff_resource_dir_entry &Entry) {
1815 Expected<const coff_resource_dir_table &>
1817 const coff_resource_dir_table *Table = nullptr;
1826 Expected<const coff_resource_dir_entry &>
1828 const coff_resource_dir_entry *Entry = nullptr;
1837 Expected<const coff_resource_data_entry &>
1839 const coff_resource_data_entry *Entry = nullptr;
1848 Expected<const coff_resource_dir_table &>
1849 ResourceSectionRef::getEntrySubDir(const coff_resource_dir_entry &Entry) {
1854 Expected<const coff_resource_data_entry &>
1855 ResourceSectionRef::getEntryData(const coff_resource_dir_entry &Entry) {
1860 Expected<const coff_resource_dir_table &> ResourceSectionRef::getBaseTable() {
1864 Expected<const coff_resource_dir_entry &>
1865 ResourceSectionRef::getTableEntry(const coff_resource_dir_table &Table,
1869 const uint8_t *TablePtr = reinterpret_cast<const uint8_t *>(&Table);
1875 Error ResourceSectionRef::load(const COFFObjectFile *O) {
1876 for (const SectionRef &S : O->sections()) {
1888 Error ResourceSectionRef::load(const COFFObjectFile *O, const SectionRef &S) {
1895 const coff_section *COFFSect = Obj->getCOFFSection(Section);
1898 for (const coff_relocation &R : OrigRelocs)
1900 llvm::sort(Relocs, [](const coff_relocation *A, const coff_relocation *B) {
1907 ResourceSectionRef::getContents(const coff_resource_data_entry &Entry) {
1913 const uint8_t *EntryPtr = reinterpret_cast<const uint8_t *>(&Entry);
1919 [](const coff_relocation *A, const coff_relocation *B) {
1926 const coff_relocation &R = **RelocsForOffset.first;
1953 Expected<const coff_section *> Section =
1967 return StringRef(reinterpret_cast<const char *>(Contents.data()) + Offset,
1977 for (const SectionRef &S : Obj->sections()) {