13#ifndef LLVM_OBJECT_ELFOBJECTFILE_H
14#define LLVM_OBJECT_ELFOBJECTFILE_H
44template <
typename T>
class SmallVectorImpl;
103 std::optional<StringRef> tryGetCPUName()
const override;
105 void setARMSubArch(
Triple &TheTriple)
const override;
113 std::vector<ELFPltEntry> getPltEntries(
const MCSubtargetInfo &STI)
const;
127 readBBAddrMap(std::optional<unsigned> TextSectionIndex = std::nullopt,
128 std::vector<PGOAnalysisMap> *PGOAnalyses =
nullptr)
const;
159 assert(isa<ELFObjectFileBase>(
B->getObject()));
200 if (EE.Value ==
Type) {
211 if (DRIA.
d.
a == DRIB.
d.
a)
212 return DRIA.
d.
b < DRIB.
d.
b;
213 return DRIA.
d.
a < DRIB.
d.
a;
269 uint16_t getEMachine()
const override;
271 uint8_t getEIdentABIVersion()
const override;
292 bool ContentValid =
false;
319 const Elf_Shdr *SymTab)
const;
366 auto SectionsOrErr =
EF.sections();
367 if (!SectionsOrErr) {
372 uintptr_t SHT =
reinterpret_cast<uintptr_t
>((*SectionsOrErr).begin());
373 unsigned SymTableIndex =
374 (
reinterpret_cast<uintptr_t
>(SymTable) - SHT) /
sizeof(Elf_Shdr);
376 DRI.
d.
a = SymTableIndex;
382 return reinterpret_cast<const Elf_Shdr *
>(Sec.
p);
387 DRI.
p =
reinterpret_cast<uintptr_t
>(Sec);
393 DRI.
p =
reinterpret_cast<uintptr_t
>(Dyn);
398 unsigned char Binding = ESym->getBinding();
399 unsigned char Visibility = ESym->getVisibility();
412 switch (getEMachine()) {
429 auto SectionsOrErr =
EF.sections();
431 return SectionsOrErr.takeError();
432 for (
const Elf_Shdr &Sec : *SectionsOrErr) {
433 if (Sec.sh_type !=
Type)
435 auto ErrorOrContents =
EF.getSectionContents(Sec);
436 if (!ErrorOrContents)
437 return ErrorOrContents.takeError();
439 auto Contents = ErrorOrContents.get();
458 bool InitContent =
true);
465 return EF.template getEntry<Elf_Sym>(
Sym.d.a,
Sym.d.b);
470 auto RelSecOrErr =
EF.getSection(Rel.
d.
a);
478 return reinterpret_cast<const Elf_Shdr *
>(Sec.
p);
506 return v->getType() ==
531 auto SectionsOrErr = EF.sections();
533 return SectionsOrErr.takeError();
535 for (
const Elf_Shdr &Sec : *SectionsOrErr) {
536 switch (Sec.sh_type) {
548 if (!DotSymtabShndxSec)
549 DotSymtabShndxSec = &Sec;
564 auto SymTabOrErr = EF.getSection(
Sym.d.a);
566 return SymTabOrErr.takeError();
567 const Elf_Shdr *SymTableSec = *SymTabOrErr;
568 auto StrTabOrErr = EF.getSection(SymTableSec->sh_link);
570 return StrTabOrErr.takeError();
571 const Elf_Shdr *StringTableSec = *StrTabOrErr;
572 auto SymStrTabOrErr = EF.getStringTable(*StringTableSec);
574 return SymStrTabOrErr.takeError();
583 return (*SecOrErr)->getName();
610 uint64_t Ret = (*SymOrErr)->st_value;
614 const Elf_Ehdr &Header = EF.getHeader();
627 if (!SymbolValueOrErr)
631 uint64_t Result = *SymbolValueOrErr;
636 switch ((*SymOrErr)->st_shndx) {
643 auto SymTabOrErr = EF.getSection(Symb.
d.
a);
645 return SymTabOrErr.takeError();
649 if (DotSymtabShndxSec) {
652 EF.getSHNDXTable(*DotSymtabShndxSec))
653 ShndxTable = *ShndxTableOrErr;
655 return ShndxTableOrErr.takeError();
659 EF.getSection(**SymOrErr, *SymTabOrErr, ShndxTable);
662 const Elf_Shdr *Section = *SectionOrErr;
664 Result += Section->sh_addr;
676 return (*SymOrErr)->st_value;
682 return EF.getHeader().e_machine;
685template <
class ELFT>
uint16_t ELFObjectFile<ELFT>::getEType()
const {
686 return EF.getHeader().e_type;
689template <
class ELFT>
uint8_t ELFObjectFile<ELFT>::getEIdentABIVersion()
const {
694uint64_t ELFObjectFile<ELFT>::getSymbolSize(DataRefImpl
Sym)
const {
695 Expected<const Elf_Sym *> SymOrErr = getSymbol(
Sym);
698 return (*SymOrErr)->st_size;
703 return getSymbolSize(Symb);
711 return (*SymOrErr)->getBinding();
719 return (*SymOrErr)->st_other;
727 return (*SymOrErr)->getType();
737 switch ((*SymOrErr)->getType()) {
761 const Elf_Sym *ESym = *SymOrErr;
777 EF.symbols(DotSymtabSec)) {
779 if (ESym == SymbolsOrErr->begin())
783 return SymbolsOrErr.takeError();
786 EF.symbols(DotDynSymSec)) {
788 if (ESym == SymbolsOrErr->begin())
792 return SymbolsOrErr.takeError();
797 if (
Name.starts_with(
"$d") ||
Name.starts_with(
"$x"))
803 }
else if (EF.getHeader().e_machine ==
ELF::EM_ARM) {
807 if (
Name.empty() ||
Name.starts_with(
"$d") ||
Name.starts_with(
"$t") ||
808 Name.starts_with(
"$a"))
814 if (ESym->getType() ==
ELF::STT_FUNC && (ESym->st_value & 1) == 1)
819 if (
Name.starts_with(
"$d") ||
Name.starts_with(
"$t"))
829 if (
Name ==
".L0 " ||
Name.starts_with(
"$d") ||
Name.starts_with(
"$x"))
843 if (isExportedToOtherDSO(ESym))
858 const Elf_Shdr *SymTab)
const {
860 if (DotSymtabShndxSec) {
863 EF.getSHNDXTable(*DotSymtabShndxSec);
864 if (!ShndxTableOrErr)
866 ShndxTable = *ShndxTableOrErr;
869 auto ESecOrErr = EF.getSection(*ESym, SymTab, ShndxTable);
873 const Elf_Shdr *ESec = *ESecOrErr;
875 return section_end();
878 Sec.
p =
reinterpret_cast<intptr_t
>(ESec);
889 auto SymTabOrErr = EF.getSection(Symb.
d.
a);
891 return SymTabOrErr.takeError();
892 return getSymbolSection(*SymOrErr, *SymTabOrErr);
913 auto SectionsOrErr = EF.sections();
916 llvm_unreachable(
"unable to get section index");
918 const Elf_Shdr *
First = SectionsOrErr->begin();
934 checkOffset(getMemoryBufferRef(),
935 (uintptr_t)base() + EShdr->sh_offset, EShdr->sh_size))
937 return ArrayRef((
const uint8_t *)base() + EShdr->sh_offset, EShdr->sh_size);
970std::vector<SectionRef>
972 std::vector<SectionRef> Res;
973 std::vector<uintptr_t> Offsets;
975 auto SectionsOrErr = EF.sections();
979 for (
const Elf_Shdr &Sec : *SectionsOrErr) {
983 reinterpret_cast<Elf_Dyn *
>((uintptr_t)base() + Sec.sh_offset);
985 if (
Dynamic->d_tag == ELF::DT_REL ||
Dynamic->d_tag == ELF::DT_RELA ||
986 Dynamic->d_tag == ELF::DT_JMPREL) {
987 Offsets.push_back(
Dynamic->d_un.d_val);
991 for (
const Elf_Shdr &Sec : *SectionsOrErr) {
993 Res.emplace_back(toDRI(&Sec),
this);
1003template <
class ELFT>
1010template <
class ELFT>
1017template <
class ELFT>
1020 if (!SectionNameOrErr) {
1030template <
class ELFT>
1034 auto SectionsOrErr = EF.sections();
1037 uintptr_t SHT =
reinterpret_cast<uintptr_t
>((*SectionsOrErr).begin());
1038 RelData.
d.
a = (Sec.
p - SHT) / EF.getHeader().e_shentsize;
1040 if (
reinterpret_cast<const Elf_Shdr *
>(Sec.
p)->sh_type ==
ELF::SHT_CREL) {
1041 if (RelData.
d.
a + 1 > Crels.size())
1042 Crels.resize(RelData.
d.
a + 1);
1043 auto &Crel = Crels[RelData.
d.
a];
1047 Error Err = decodeCrel<ELFT::Is64Bits>(
1049 [&](Elf_Crel Crel) { Crels[RelData.
d.
a][
I++] = Crel; });
1051 Crel.assign(1, Elf_Crel{0, 0, 0, 0});
1052 if (RelData.
d.
a + 1 > CrelDecodeProblems.size())
1053 CrelDecodeProblems.resize(RelData.
d.
a + 1);
1054 CrelDecodeProblems[RelData.
d.
a] =
toString(std::move(Err));
1061template <
class ELFT>
1064 const Elf_Shdr *S =
reinterpret_cast<const Elf_Shdr *
>(Sec.
p);
1068 RelData.
d.
b = Crels[RelData.
d.
a].size();
1073 const Elf_Shdr *RelSec = getRelSection(RelData);
1076 auto SymSecOrErr = EF.getSection(RelSec->sh_link);
1081 RelData.
d.
b += S->sh_size / S->sh_entsize;
1085template <
class ELFT>
1089 uintX_t
Type = EShdr->sh_type;
1091 return section_end();
1100template <
class ELFT>
1105template <
class ELFT>
1109 const Elf_Shdr *sec = getRelSection(Rel);
1111 symbolIdx = getCrel(Rel).r_symidx;
1113 symbolIdx = getRel(Rel)->getSymbol(EF.isMips64EL());
1115 symbolIdx = getRela(Rel)->getSymbol(EF.isMips64EL());
1117 return symbol_end();
1121 SymbolData.
d.
a = sec->sh_link;
1122 SymbolData.
d.
b = symbolIdx;
1126template <
class ELFT>
1128 const Elf_Shdr *sec = getRelSection(Rel);
1130 return getCrel(Rel).r_offset;
1132 return getRel(Rel)->r_offset;
1134 return getRela(Rel)->r_offset;
1137template <
class ELFT>
1139 const Elf_Shdr *sec = getRelSection(Rel);
1141 return getCrel(Rel).r_type;
1143 return getRel(Rel)->getType(EF.isMips64EL());
1145 return getRela(Rel)->getType(EF.isMips64EL());
1148template <
class ELFT>
1153template <
class ELFT>
1156 uint32_t type = getRelocationType(Rel);
1157 EF.getRelocationTypeName(type, Result);
1160template <
class ELFT>
1164 return (int64_t)getRela(Rel)->r_addend;
1166 return (int64_t)getCrel(Rel).r_addend;
1167 return createError(
"Relocation section does not have addends");
1170template <
class ELFT>
1174 auto Ret = EF.template getEntry<Elf_Rel>(Rel.
d.
a, Rel.
d.
b);
1180template <
class ELFT>
1184 auto Ret = EF.template getEntry<Elf_Rela>(Rela.
d.
a, Rela.
d.
b);
1190template <
class ELFT>
1195 return Crels[Crel.
d.
a][Crel.
d.
b];
1198template <
class ELFT>
1202 if (
Error E = EFOrErr.takeError())
1203 return std::move(
E);
1209 return std::move(
E);
1210 return std::move(Obj);
1213template <
class ELFT>
1215 const Elf_Shdr *DotDynSymSec,
1216 const Elf_Shdr *DotSymtabSec,
1217 const Elf_Shdr *DotSymtabShndx)
1221 EF(EF), DotDynSymSec(DotDynSymSec), DotSymtabSec(DotSymtabSec),
1222 DotSymtabShndxSec(DotSymtabShndx) {}
1224template <
class ELFT>
1227 Other.DotSymtabSec,
Other.DotSymtabShndxSec) {}
1229template <
class ELFT>
1233 DotSymtabSec && DotSymtabSec->sh_size >=
sizeof(Elf_Sym) ? 1 : 0);
1237template <
class ELFT>
1239 const Elf_Shdr *SymTab = DotSymtabSec;
1241 return symbol_begin();
1242 DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size /
sizeof(Elf_Sym));
1246template <
class ELFT>
1248 if (!DotDynSymSec || DotDynSymSec->sh_size <
sizeof(Elf_Sym))
1256template <
class ELFT>
1258 const Elf_Shdr *SymTab = DotDynSymSec;
1260 return dynamic_symbol_begin();
1261 DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size /
sizeof(Elf_Sym));
1265template <
class ELFT>
1267 auto SectionsOrErr = EF.sections();
1273template <
class ELFT>
1275 auto SectionsOrErr = EF.sections();
1281template <
class ELFT>
1283 return ELFT::Is64Bits ? 8 : 4;
1286template <
class ELFT>
1291 switch (EF.getHeader().e_machine) {
1293 return "elf32-m68k";
1295 return "elf32-i386";
1297 return "elf32-iamcu";
1299 return "elf32-x86-64";
1301 return (IsLittleEndian ?
"elf32-littlearm" :
"elf32-bigarm");
1305 return "elf32-hexagon";
1307 return "elf32-lanai";
1309 return "elf32-mips";
1311 return "elf32-msp430";
1313 return (IsLittleEndian ?
"elf32-powerpcle" :
"elf32-powerpc");
1315 return (IsLittleEndian ?
"elf32-littleriscv" :
"elf32-bigriscv");
1317 return "elf32-csky";
1320 return "elf32-sparc";
1322 return "elf32-amdgpu";
1324 return "elf32-loongarch";
1326 return "elf32-xtensa";
1328 return "elf32-unknown";
1331 switch (EF.getHeader().e_machine) {
1333 return "elf64-i386";
1335 return "elf64-x86-64";
1337 return (IsLittleEndian ?
"elf64-littleaarch64" :
"elf64-bigaarch64");
1339 return (IsLittleEndian ?
"elf64-powerpcle" :
"elf64-powerpc");
1341 return (IsLittleEndian ?
"elf64-littleriscv" :
"elf64-bigriscv");
1343 return "elf64-s390";
1345 return "elf64-sparc";
1347 return "elf64-mips";
1349 return "elf64-amdgpu";
1355 return "elf64-loongarch";
1357 return "elf64-unknown";
1367 switch (EF.getHeader().e_machine) {
1419 if (!IsLittleEndian)
1495template <
class ELFT>
1497 return EF.getHeader().e_entry;
1500template <
class ELFT>
1503 return make_range(dynamic_symbol_begin(), dynamic_symbol_end());
1510template <
class ELFT>
1512 uintptr_t SHT =
reinterpret_cast<uintptr_t
>(
cantFail(EF.sections()).begin());
1513 auto I = (Sec.
p - SHT) / EF.getHeader().e_shentsize;
1514 if (
I < CrelDecodeProblems.size())
1515 return CrelDecodeProblems[
I];
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static StringRef getSymbolName(SymbolKind SymKind)
DXIL Resource Implicit Binding
#define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
static FeatureBitset getFeatures(MCSubtargetInfo &STI, StringRef CPU, StringRef TuneCPU, StringRef FS, ArrayRef< StringRef > ProcNames, ArrayRef< SubtargetSubTypeKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
static uint64_t getSymbolValue(const MCSymbolCOFF &Symbol, const MCAssembler &Asm)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Base class for error info classes.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
Generic base class for all target subtargets.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Manages the enabling and disabling of subtarget specific features.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
A range adaptor for a pair of iterators.
const SymbolicFile * getObject() const
DataRefImpl getRawDataRefImpl() const
static unsigned int getELFType(bool isLE, bool is64Bits)
static Expected< ELFFile > create(StringRef Object)
virtual uint64_t getSymbolSize(DataRefImpl Symb) const =0
virtual uint8_t getEIdentABIVersion() const =0
virtual Error getBuildAttributes(ELFAttributeParser &Attributes) const =0
virtual uint64_t getSectionFlags(DataRefImpl Sec) const =0
virtual uint16_t getEType() const =0
virtual uint8_t getSymbolELFType(DataRefImpl Symb) const =0
virtual uint8_t getSymbolOther(DataRefImpl Symb) const =0
virtual elf_symbol_iterator_range getDynamicSymbolIterators() const =0
virtual uint32_t getSectionType(DataRefImpl Sec) const =0
friend class ELFSymbolRef
elf_symbol_iterator_range symbols() const
virtual Expected< int64_t > getRelocationAddend(DataRefImpl Rel) const =0
virtual uint8_t getSymbolBinding(DataRefImpl Symb) const =0
iterator_range< elf_symbol_iterator > elf_symbol_iterator_range
virtual uint16_t getEMachine() const =0
static bool classof(const Binary *v)
virtual unsigned getPlatformFlags() const =0
Returns platform-specific object flags, if any.
virtual uint64_t getSectionOffset(DataRefImpl Sec) const =0
static bool classof(const Binary *v)
const ELFFile< ELFT > & getELFFile() const
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
std::vector< SectionRef > dynamic_relocation_sections() const override
uint64_t getRelocationType(DataRefImpl Rel) const override
bool isSectionText(DataRefImpl Sec) const override
uint8_t getSymbolELFType(DataRefImpl Symb) const override
uint64_t getSectionAlignment(DataRefImpl Sec) const override
bool is64Bit() const override
DataRefImpl toDRI(const Elf_Dyn *Dyn) const
bool isSectionVirtual(DataRefImpl Sec) const override
Triple::OSType getOS() const override
SectionRef toSectionRef(const Elf_Shdr *Sec) const
bool IsContentValid() const
uint32_t getSectionType(DataRefImpl Sec) const override
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
elf_symbol_iterator_range getDynamicSymbolIterators() const override
void createFakeSections()
Expected< const Elf_Sym * > getSymbol(DataRefImpl Sym) const
const Elf_Rel * getRel(DataRefImpl Rel) const
Elf_Crel getCrel(DataRefImpl Crel) const
Expected< section_iterator > getSymbolSection(const Elf_Sym *Symb, const Elf_Shdr *SymTab) const
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
basic_symbol_iterator symbol_begin() const override
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
ELFSymbolRef toSymbolRef(const Elf_Shdr *SymTable, unsigned SymbolNum) const
SmallVector< std::string, 0 > CrelDecodeProblems
const Elf_Rela * getRela(DataRefImpl Rela) const
static Expected< ELFObjectFile< ELFT > > create(MemoryBufferRef Object, bool InitContent=true)
bool isExportedToOtherDSO(const Elf_Sym *ESym) const
uint64_t getSectionAddress(DataRefImpl Sec) const override
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
uint64_t getSectionIndex(DataRefImpl Sec) const override
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
bool isSectionData(DataRefImpl Sec) const override
const Elf_Shdr * DotSymtabSec
const Elf_Shdr * DotDynSymSec
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
const Elf_Shdr * toELFShdrIter(DataRefImpl Sec) const
Triple::ArchType getArch() const override
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
uint64_t getSectionSize(DataRefImpl Sec) const override
bool isBerkeleyData(DataRefImpl Sec) const override
StringRef getFileFormatName() const override
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
void moveSymbolNext(DataRefImpl &Symb) const override
uint8_t getSymbolOther(DataRefImpl Symb) const override
section_iterator section_end() const override
const Elf_Shdr * getRelSection(DataRefImpl Rel) const
Get the relocation section that contains Rel.
Expected< int64_t > getRelocationAddend(DataRefImpl Rel) const override
uint64_t getRelocationOffset(DataRefImpl Rel) const override
Expected< section_iterator > getRelocatedSection(DataRefImpl Sec) const override
void moveSectionNext(DataRefImpl &Sec) const override
bool isSectionBSS(DataRefImpl Sec) const override
unsigned getPlatformFlags() const override
Returns platform-specific object flags, if any.
uint64_t getSectionFlags(DataRefImpl Sec) const override
void moveRelocationNext(DataRefImpl &Rel) const override
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
Error initContent() override
basic_symbol_iterator symbol_end() const override
uint8_t getSymbolBinding(DataRefImpl Symb) const override
uint64_t getSectionOffset(DataRefImpl Sec) const override
relocation_iterator section_rel_end(DataRefImpl Sec) const override
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
const Elf_Shdr * getSection(DataRefImpl Sec) const
Error getBuildAttributes(ELFAttributeParser &Attributes) const override
DataRefImpl toDRI(const Elf_Shdr *Sec) const
elf_symbol_iterator dynamic_symbol_begin() const
const Elf_Shdr * DotSymtabShndxSec
elf_symbol_iterator dynamic_symbol_end() const
DataRefImpl toDRI(const Elf_Shdr *SymTable, unsigned SymbolNum) const
bool isDebugSection(DataRefImpl Sec) const override
section_iterator section_begin() const override
bool isSectionCompressed(DataRefImpl Sec) const override
SmallVector< SmallVector< Elf_Crel, 0 >, 0 > Crels
bool isBerkeleyText(DataRefImpl Sec) const override
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
Expected< uint64_t > getStartAddress() const override
StringRef getCrelDecodeProblem(DataRefImpl Sec) const
Expected< int64_t > getAddend() const
const ELFObjectFileBase * getObject() const
ELFRelocationRef(const RelocationRef &B)
uint64_t getFlags() const
const ELFObjectFileBase * getObject() const
uint64_t getOffset() const
ELFSectionRef(const SectionRef &B)
const ELFObjectFileBase * getObject() const
uint8_t getELFType() const
ELFSymbolRef(const SymbolRef &B)
uint8_t getBinding() const
StringRef getELFTypeName() const
This class is the base class for all object file types.
This is a value type class that represents a single relocation in the list of relocations in the obje...
const ObjectFile * getObject() const
DataRefImpl getRawDataRefImpl() const
This is a value type class that represents a single section in the list of sections in the object fil...
DataRefImpl getRawDataRefImpl() const
const ObjectFile * getObject() const
This is a value type class that represents a single symbol in the list of symbols in the object file.
const ObjectFile * getObject() const
virtual basic_symbol_iterator symbol_begin() const =0
virtual basic_symbol_iterator symbol_end() const =0
const SectionRef & operator*() const
const SectionRef * operator->() const
const ELFRelocationRef & operator*() const
elf_relocation_iterator(const relocation_iterator &B)
const ELFRelocationRef * operator->() const
elf_section_iterator(const section_iterator &B)
const ELFSectionRef * operator->() const
const ELFSectionRef & operator*() const
const ELFSymbolRef & operator*() const
elf_symbol_iterator(const basic_symbol_iterator &B)
const ELFSymbolRef * operator->() const
const SymbolRef * operator->() const
const SymbolRef & operator*() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ EF_AMDGPU_MACH_AMDGCN_LAST
@ EF_AMDGPU_MACH_R600_LAST
@ EF_AMDGPU_MACH_AMDGCN_FIRST
@ EF_AMDGPU_MACH_R600_FIRST
static constexpr const StringLiteral & getSectionName(DebugSectionKind SectionKind)
Return the name of the section.
static Expected< const T * > getObject(MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
Expected< const typename ELFT::Shdr * > getSection(typename ELFT::ShdrRange Sections, uint32_t Index)
bool operator<(const ELFSymbolRef &A, const ELFSymbolRef &B)
Error createError(const Twine &Err)
LLVM_ABI StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type)
constexpr int NumElfSymbolTypes
content_iterator< SectionRef > section_iterator
content_iterator< RelocationRef > relocation_iterator
content_iterator< BasicSymbolRef > basic_symbol_iterator
LLVM_ABI const llvm::EnumEntry< unsigned > ElfSymbolTypes[NumElfSymbolTypes]
This is an optimization pass for GlobalISel generic memory operations.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
@ Dynamic
Denotes mode unknown at compile time.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
const char * toString(DWARFSectionKind Kind)
LLVM_ABI std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
void consumeError(Error Err)
Consume a Error without doing anything.
std::optional< DataRefImpl > Symbol
struct llvm::object::DataRefImpl::@378 d