1//===- ELFObjectFile.h - ELF object file implementation ---------*- C++ -*-===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This file declares the ELFObjectFile template class. 11//===----------------------------------------------------------------------===// 13#ifndef LLVM_OBJECT_ELFOBJECTFILE_H 14#define LLVM_OBJECT_ELFOBJECTFILE_H 42template <
typename T>
classSmallVectorImpl;
91 /// Returns platform-specific object flags, if any. 112 /// Returns a vector containing a symbol version for each dynamic symbol. 113 /// Returns an empty vector if version sections do not exist. 116 /// Returns a vector of all BB address maps in the object file. When 117 /// `TextSectionIndex` is specified, only returns the BB address maps 118 /// corresponding to the section with that index. When `PGOAnalyses`is 119 /// specified (PGOAnalyses is not nullptr), the vector is cleared then filled 120 /// with extra PGO data. `PGOAnalyses` will always be the same length as the 121 /// return value when it is requested assuming no error occurs. Upon failure, 122 /// `PGOAnalyses` will be emptied. 124readBBAddrMap(std::optional<unsigned> TextSectionIndex = std::nullopt,
125 std::vector<PGOAnalysisMap> *PGOAnalyses =
nullptr)
const;
156assert(isa<ELFObjectFileBase>(
B->getObject()));
197if (EE.Value ==
Type) {
208if (DRIA.
d.
a == DRIB.
d.
a)
209return DRIA.
d.
b < DRIB.
d.
b;
210return DRIA.
d.
a < DRIB.
d.
a;
266uint16_t getEMachine()
const override;
268uint8_t getEIdentABIVersion()
const override;
289bool ContentValid =
false;
298// Hold CREL relocations for SectionRef::relocations(). 316const Elf_Shdr *SymTab)
const;
363auto SectionsOrErr =
EF.sections();
369 uintptr_t SHT =
reinterpret_cast<uintptr_t
>((*SectionsOrErr).begin());
370unsigned SymTableIndex =
371 (
reinterpret_cast<uintptr_t
>(SymTable) - SHT) /
sizeof(Elf_Shdr);
373 DRI.
d.
a = SymTableIndex;
379returnreinterpret_cast<constElf_Shdr *
>(Sec.
p);
384 DRI.
p =
reinterpret_cast<uintptr_t
>(Sec);
390 DRI.
p =
reinterpret_cast<uintptr_t
>(Dyn);
395unsignedchar Binding = ESym->getBinding();
396unsignedchar Visibility = ESym->getVisibility();
398// A symbol is exported if its binding is either GLOBAL or WEAK, and its 399// visibility is either DEFAULT or PROTECTED. All other symbols are not 409switch (getEMachine()) {
423auto SectionsOrErr =
EF.sections();
425return SectionsOrErr.takeError();
426for (
const Elf_Shdr &Sec : *SectionsOrErr) {
427if (Sec.sh_type !=
Type)
429auto ErrorOrContents =
EF.getSectionContents(Sec);
431return ErrorOrContents.takeError();
433auto Contents = ErrorOrContents.get();
444// This flag is used for classof, to distinguish ELFObjectFile from 445// its subclass. If more subclasses will be created, this flag will 446// have to become an enum. 452bool InitContent =
true);
459returnEF.template getEntry<Elf_Sym>(
Sym.d.a,
Sym.d.b);
462 /// Get the relocation section that contains \a Rel. 464auto RelSecOrErr =
EF.getSection(Rel.
d.
a);
472returnreinterpret_cast<constElf_Shdr *
>(Sec.
p);
500return v->getType() ==
525auto SectionsOrErr = EF.sections();
527return SectionsOrErr.takeError();
529for (
const Elf_Shdr &Sec : *SectionsOrErr) {
530switch (Sec.sh_type) {
542if (!DotSymtabShndxSec)
543 DotSymtabShndxSec = &Sec;
558auto SymTabOrErr = EF.getSection(
Sym.d.a);
560return SymTabOrErr.takeError();
561const Elf_Shdr *SymTableSec = *SymTabOrErr;
562auto StrTabOrErr = EF.getSection(SymTableSec->sh_link);
564return StrTabOrErr.takeError();
565const Elf_Shdr *StringTableSec = *StrTabOrErr;
566auto SymStrTabOrErr = EF.getStringTable(*StringTableSec);
568return SymStrTabOrErr.takeError();
573// If the symbol name is empty use the section name. 577return (*SecOrErr)->getName();
604uint64_t Ret = (*SymOrErr)->st_value;
608const Elf_Ehdr &Header = EF.getHeader();
609// Clear the ARM/Thumb or microMIPS indicator flag. 621if (!SymbolValueOrErr)
622// TODO: Test this error. 630switch ((*SymOrErr)->st_shndx) {
637auto SymTabOrErr = EF.getSection(Symb.
d.
a);
639return SymTabOrErr.takeError();
643if (DotSymtabShndxSec) {
644// TODO: Test this error. 646 EF.getSHNDXTable(*DotSymtabShndxSec))
647 ShndxTable = *ShndxTableOrErr;
649return ShndxTableOrErr.takeError();
653 EF.getSection(**SymOrErr, *SymTabOrErr, ShndxTable);
656const Elf_Shdr *Section = *SectionOrErr;
658 Result += Section->sh_addr;
670return (*SymOrErr)->st_value;
676return EF.getHeader().e_machine;
679template <
class ELFT>
uint16_t ELFObjectFile<ELFT>::getEType()
const{
680return EF.getHeader().e_type;
683template <
class ELFT>
uint8_t ELFObjectFile<ELFT>::getEIdentABIVersion()
const{
688uint64_t ELFObjectFile<ELFT>::getSymbolSize(DataRefImpl
Sym)
const{
689 Expected<const Elf_Sym *> SymOrErr = getSymbol(
Sym);
692return (*SymOrErr)->st_size;
697return getSymbolSize(Symb);
705return (*SymOrErr)->getBinding();
713return (*SymOrErr)->st_other;
721return (*SymOrErr)->getType();
731switch ((*SymOrErr)->getType()) {
755const Elf_Sym *ESym = *SymOrErr;
771 EF.symbols(DotSymtabSec)) {
772// Set the SF_FormatSpecific flag for the 0-index null symbol. 773if (ESym == SymbolsOrErr->begin())
776// TODO: Test this error. 777return SymbolsOrErr.takeError();
780 EF.symbols(DotDynSymSec)) {
781// Set the SF_FormatSpecific flag for the 0-index null symbol. 782if (ESym == SymbolsOrErr->begin())
785// TODO: Test this error. 786return SymbolsOrErr.takeError();
791if (
Name.starts_with(
"$d") ||
Name.starts_with(
"$x"))
794// TODO: Actually report errors helpfully. 800// TODO Investigate why empty name symbols need to be marked. 801if (
Name.empty() ||
Name.starts_with(
"$d") ||
Name.starts_with(
"$t") ||
802Name.starts_with(
"$a"))
805// TODO: Actually report errors helpfully. 808if (ESym->getType() ==
ELF::STT_FUNC && (ESym->st_value & 1) == 1)
813if (
Name.starts_with(
"$d") ||
Name.starts_with(
"$t"))
816// TODO: Actually report errors helpfully. 822// Mark fake labels (used for label differences) and mapping symbols. 823if (
Name ==
".L0 " ||
Name.starts_with(
"$d") ||
Name.starts_with(
"$x"))
826// TODO: Actually report errors helpfully. 837if (isExportedToOtherDSO(ESym))
852const Elf_Shdr *SymTab)
const{
854if (DotSymtabShndxSec) {
855// TODO: Test this error. 857 EF.getSHNDXTable(*DotSymtabShndxSec);
860 ShndxTable = *ShndxTableOrErr;
863auto ESecOrErr = EF.getSection(*ESym, SymTab, ShndxTable);
867const Elf_Shdr *ESec = *ESecOrErr;
872 Sec.
p =
reinterpret_cast<intptr_t
>(ESec);
883auto SymTabOrErr = EF.getSection(Symb.
d.
a);
885return SymTabOrErr.takeError();
886return getSymbolSection(*SymOrErr, *SymTabOrErr);
907auto SectionsOrErr = EF.sections();
910 llvm_unreachable(
"unable to get section index");
912const Elf_Shdr *
First = SectionsOrErr->begin();
928 checkOffset(getMemoryBufferRef(),
929 (uintptr_t)base() + EShdr->sh_offset, EShdr->sh_size))
931returnArrayRef((
constuint8_t *)base() + EShdr->sh_offset, EShdr->sh_size);
964std::vector<SectionRef>
966 std::vector<SectionRef> Res;
967 std::vector<uintptr_t> Offsets;
969auto SectionsOrErr = EF.sections();
973for (
const Elf_Shdr &Sec : *SectionsOrErr) {
977reinterpret_cast<Elf_Dyn *
>((uintptr_t)base() + Sec.sh_offset);
979if (
Dynamic->d_tag == ELF::DT_REL ||
Dynamic->d_tag == ELF::DT_RELA ||
980Dynamic->d_tag == ELF::DT_JMPREL) {
981 Offsets.push_back(
Dynamic->d_un.d_val);
985for (
const Elf_Shdr &Sec : *SectionsOrErr) {
987 Res.emplace_back(toDRI(&Sec),
this);
1004template <
class ELFT>
1011template <
class ELFT>
1014if (!SectionNameOrErr) {
1015// TODO: Report the error message properly. 1024template <
class ELFT>
1028auto SectionsOrErr = EF.sections();
1031 uintptr_t SHT =
reinterpret_cast<uintptr_t
>((*SectionsOrErr).begin());
1032 RelData.
d.
a = (Sec.
p - SHT) / EF.getHeader().e_shentsize;
1034if (
reinterpret_cast<constElf_Shdr *
>(Sec.
p)->sh_type ==
ELF::SHT_CREL) {
1035if (RelData.
d.
a + 1 > Crels.size())
1036 Crels.resize(RelData.
d.
a + 1);
1037auto &Crel = Crels[RelData.
d.
a];
1041Error Err = decodeCrel<ELFT::Is64Bits>(
1043 [&](Elf_Crel Crel) { Crels[RelData.
d.
a][
I++] = Crel; });
1045 Crel.assign(1, Elf_Crel{0, 0, 0, 0});
1046if (RelData.
d.
a + 1 > CrelDecodeProblems.size())
1047 CrelDecodeProblems.resize(RelData.
d.
a + 1);
1048 CrelDecodeProblems[RelData.
d.
a] =
toString(std::move(Err));
1055template <
class ELFT>
1058const Elf_Shdr *S =
reinterpret_cast<constElf_Shdr *
>(Sec.
p);
1062 RelData.
d.
b = Crels[RelData.
d.
a].size();
1067const Elf_Shdr *RelSec = getRelSection(RelData);
1069// Error check sh_link here so that getRelocationSymbol can just use it. 1070auto SymSecOrErr = EF.getSection(RelSec->sh_link);
1075 RelData.
d.
b += S->sh_size / S->sh_entsize;
1079template <
class ELFT>
1083 uintX_t
Type = EShdr->sh_type;
1085return section_end();
1094template <
class ELFT>
1099template <
class ELFT>
1103const Elf_Shdr *sec = getRelSection(Rel);
1105 symbolIdx = getCrel(Rel).r_symidx;
1107 symbolIdx = getRel(Rel)->getSymbol(EF.isMips64EL());
1109 symbolIdx = getRela(Rel)->getSymbol(EF.isMips64EL());
1113// FIXME: error check symbolIdx 1115 SymbolData.
d.
a = sec->sh_link;
1116 SymbolData.
d.
b = symbolIdx;
1120template <
class ELFT>
1122const Elf_Shdr *sec = getRelSection(Rel);
1124return getCrel(Rel).r_offset;
1126return getRel(Rel)->r_offset;
1128return getRela(Rel)->r_offset;
1131template <
class ELFT>
1133const Elf_Shdr *sec = getRelSection(Rel);
1135return getCrel(Rel).r_type;
1137return getRel(Rel)->getType(EF.isMips64EL());
1139return getRela(Rel)->getType(EF.isMips64EL());
1142template <
class ELFT>
1147template <
class ELFT>
1150uint32_t type = getRelocationType(Rel);
1151 EF.getRelocationTypeName(type, Result);
1154template <
class ELFT>
1158return (int64_t)getRela(Rel)->r_addend;
1160return (int64_t)getCrel(Rel).r_addend;
1161returncreateError(
"Relocation section does not have addends");
1164template <
class ELFT>
1168auto Ret = EF.template getEntry<Elf_Rel>(Rel.
d.
a, Rel.
d.
b);
1174template <
class ELFT>
1178auto Ret = EF.template getEntry<Elf_Rela>(Rela.
d.
a, Rela.
d.
b);
1184template <
class ELFT>
1189return Crels[Crel.
d.
a][Crel.
d.
b];
1192template <
class ELFT>
1196if (
ErrorE = EFOrErr.takeError())
1204return std::move(Obj);
1207template <
class ELFT>
1209const Elf_Shdr *DotDynSymSec,
1210const Elf_Shdr *DotSymtabSec,
1211const Elf_Shdr *DotSymtabShndx)
1215 EF(EF), DotDynSymSec(DotDynSymSec), DotSymtabSec(DotSymtabSec),
1216 DotSymtabShndxSec(DotSymtabShndx) {}
1218template <
class ELFT>
1221Other.DotSymtabSec,
Other.DotSymtabShndxSec) {}
1223template <
class ELFT>
1227 DotSymtabSec && DotSymtabSec->sh_size >=
sizeof(Elf_Sym) ? 1 : 0);
1231template <
class ELFT>
1233const Elf_Shdr *SymTab = DotSymtabSec;
1235return symbol_begin();
1240template <
class ELFT>
1242if (!DotDynSymSec || DotDynSymSec->sh_size <
sizeof(Elf_Sym))
1243// Ignore errors here where the dynsym is empty or sh_size less than the 1244// size of one symbol. These should be handled elsewhere. 1246// Skip 0-index NULL symbol. 1250template <
class ELFT>
1252const Elf_Shdr *SymTab = DotDynSymSec;
1254return dynamic_symbol_begin();
1259template <
class ELFT>
1261auto SectionsOrErr = EF.sections();
1267template <
class ELFT>
1269auto SectionsOrErr = EF.sections();
1275template <
class ELFT>
1277return ELFT::Is64Bits ? 8 : 4;
1280template <
class ELFT>
1285switch (EF.getHeader().e_machine) {
1293return"elf32-x86-64";
1295return (IsLittleEndian ?
"elf32-littlearm" :
"elf32-bigarm");
1299return"elf32-hexagon";
1305return"elf32-msp430";
1307return (IsLittleEndian ?
"elf32-powerpcle" :
"elf32-powerpc");
1309return"elf32-littleriscv";
1316return"elf32-amdgpu";
1318return"elf32-loongarch";
1320return"elf32-xtensa";
1322return"elf32-unknown";
1325switch (EF.getHeader().e_machine) {
1329return"elf64-x86-64";
1331return (IsLittleEndian ?
"elf64-littleaarch64" :
"elf64-bigaarch64");
1333return (IsLittleEndian ?
"elf64-powerpcle" :
"elf64-powerpc");
1335return"elf64-littleriscv";
1343return"elf64-amdgpu";
1349return"elf64-loongarch";
1351return"elf64-unknown";
1354// FIXME: Proper error handling. 1361switch (EF.getHeader().e_machine) {
1488template <
class ELFT>
1490return EF.getHeader().e_entry;
1493template <
class ELFT>
1496returnmake_range(dynamic_symbol_begin(), dynamic_symbol_end());
1503template <
class ELFT>
1505 uintptr_t SHT =
reinterpret_cast<uintptr_t
>(
cantFail(EF.sections()).begin());
1506autoI = (Sec.
p - SHT) / EF.getHeader().e_shentsize;
1507if (
I < CrelDecodeProblems.size())
1508return CrelDecodeProblems[
I];
1512}
// end namespace object 1513}
// end namespace llvm 1515#endif// LLVM_OBJECT_ELFOBJECTFILE_H 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)
#define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
static uint64_t getSymbolValue(const MCSymbol &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.
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
Expected< std::vector< VersionEntry > > readDynsymVersions() const
Returns a vector containing a symbol version for each dynamic symbol.
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
StringRef getCrelDecodeProblem(SectionRef Sec) const
elf_symbol_iterator_range symbols() const
virtual Expected< int64_t > getRelocationAddend(DataRefImpl Rel) const =0
std::vector< ELFPltEntry > getPltEntries() const
Expected< SubtargetFeatures > getFeatures() const override
virtual uint8_t getSymbolBinding(DataRefImpl Symb) const =0
std::optional< StringRef > tryGetCPUName() const override
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.
void setARMSubArch(Triple &TheTriple) const override
virtual uint64_t getSectionOffset(DataRefImpl Sec) const =0
Expected< std::vector< BBAddrMap > > readBBAddrMap(std::optional< unsigned > TextSectionIndex=std::nullopt, std::vector< PGOAnalysisMap > *PGOAnalyses=nullptr) const
Returns a vector of all BB address maps in the object file.
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)
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
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.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ 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)
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::@370 d