#ifndef LLVM_OBJECT_ELF_H
#define LLVM_OBJECT_ELF_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Error.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <utility>
namespace llvm {
namespace object {
struct VerdAux { … };
struct VerDef { … };
struct VernAux { … };
struct VerNeed { … };
struct VersionEntry { … };
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type);
uint32_t getELFRelativeRelocationType(uint32_t Machine);
StringRef getELFSectionTypeName(uint32_t Machine, uint32_t Type);
inline std::pair<unsigned char, unsigned char>
getElfArchType(StringRef Object) { … }
enum PPCInstrMasks : uint64_t { … };
template <class ELFT> class ELFFile;
template <class T> struct DataRegion { … };
template <class ELFT>
static std::string getSecIndexForError(const ELFFile<ELFT> &Obj,
const typename ELFT::Shdr &Sec) { … }
template <class ELFT>
static std::string describe(const ELFFile<ELFT> &Obj,
const typename ELFT::Shdr &Sec) { … }
template <class ELFT>
static std::string getPhdrIndexForError(const ELFFile<ELFT> &Obj,
const typename ELFT::Phdr &Phdr) { … }
static inline Error defaultWarningHandler(const Twine &Msg) { … }
template <class ELFT>
static bool checkSectionOffsets(const typename ELFT::Phdr &Phdr,
const typename ELFT::Shdr &Sec) { … }
template <class ELFT>
static bool checkSectionVMA(const typename ELFT::Phdr &Phdr,
const typename ELFT::Shdr &Sec) { … }
template <class ELFT>
static bool isSectionInSegment(const typename ELFT::Phdr &Phdr,
const typename ELFT::Shdr &Sec) { … }
template <bool Is64>
static Error decodeCrel(
ArrayRef<uint8_t> Content,
function_ref<void(uint64_t , bool )>
HdrHandler,
function_ref<void(Elf_Crel_Impl<Is64>)> EntryHandler) { … }
template <class ELFT>
class ELFFile { … };
ELF32LEFile;
ELF64LEFile;
ELF32BEFile;
ELF64BEFile;
template <class ELFT>
inline Expected<const typename ELFT::Shdr *>
getSection(typename ELFT::ShdrRange Sections, uint32_t Index) { … }
template <class ELFT>
inline Expected<uint32_t>
getExtendedSymbolTableIndex(const typename ELFT::Sym &Sym, unsigned SymIndex,
DataRegion<typename ELFT::Word> ShndxTable) { … }
template <class ELFT>
Expected<uint32_t>
ELFFile<ELFT>::getSectionIndex(const Elf_Sym &Sym, Elf_Sym_Range Syms,
DataRegion<Elf_Word> ShndxTable) const { … }
template <class ELFT>
Expected<const typename ELFT::Shdr *>
ELFFile<ELFT>::getSection(const Elf_Sym &Sym, const Elf_Shdr *SymTab,
DataRegion<Elf_Word> ShndxTable) const { … }
template <class ELFT>
Expected<const typename ELFT::Shdr *>
ELFFile<ELFT>::getSection(const Elf_Sym &Sym, Elf_Sym_Range Symbols,
DataRegion<Elf_Word> ShndxTable) const { … }
template <class ELFT>
Expected<const typename ELFT::Sym *>
ELFFile<ELFT>::getSymbol(const Elf_Shdr *Sec, uint32_t Index) const { … }
template <class ELFT>
template <typename T>
Expected<ArrayRef<T>>
ELFFile<ELFT>::getSectionContentsAsArray(const Elf_Shdr &Sec) const { … }
template <class ELFT>
Expected<ArrayRef<uint8_t>>
ELFFile<ELFT>::getSegmentContents(const Elf_Phdr &Phdr) const { … }
template <class ELFT>
Expected<ArrayRef<uint8_t>>
ELFFile<ELFT>::getSectionContents(const Elf_Shdr &Sec) const { … }
template <class ELFT>
StringRef ELFFile<ELFT>::getRelocationTypeName(uint32_t Type) const { … }
template <class ELFT>
void ELFFile<ELFT>::getRelocationTypeName(uint32_t Type,
SmallVectorImpl<char> &Result) const { … }
template <class ELFT>
uint32_t ELFFile<ELFT>::getRelativeRelocationType() const { … }
template <class ELFT>
Expected<SmallVector<std::optional<VersionEntry>, 0>>
ELFFile<ELFT>::loadVersionMap(const Elf_Shdr *VerNeedSec,
const Elf_Shdr *VerDefSec) const { … }
template <class ELFT>
Expected<const typename ELFT::Sym *>
ELFFile<ELFT>::getRelocationSymbol(const Elf_Rel &Rel,
const Elf_Shdr *SymTab) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getSectionStringTable(Elf_Shdr_Range Sections,
WarningHandler WarnHandler) const { … }
template <class ELFT>
static Expected<uint64_t>
getDynSymtabSizeFromGnuHash(const typename ELFT::GnuHash &Table,
const void *BufEnd) { … }
template <class ELFT>
Expected<uint64_t> ELFFile<ELFT>::getDynSymtabSize() const { … }
template <class ELFT> ELFFile<ELFT>::ELFFile(StringRef Object) : … { … }
template <class ELFT>
Expected<ELFFile<ELFT>> ELFFile<ELFT>::create(StringRef Object) { … }
template <class ELFT> void ELFFile<ELFT>::createFakeSections() { … }
template <class ELFT>
Expected<typename ELFT::ShdrRange> ELFFile<ELFT>::sections() const { … }
template <class ELFT>
template <typename T>
Expected<const T *> ELFFile<ELFT>::getEntry(uint32_t Section,
uint32_t Entry) const { … }
template <class ELFT>
template <typename T>
Expected<const T *> ELFFile<ELFT>::getEntry(const Elf_Shdr &Section,
uint32_t Entry) const { … }
template <typename ELFT>
Expected<StringRef> ELFFile<ELFT>::getSymbolVersionByIndex(
uint32_t SymbolVersionIndex, bool &IsDefault,
SmallVector<std::optional<VersionEntry>, 0> &VersionMap,
std::optional<bool> IsSymHidden) const { … }
template <class ELFT>
Expected<std::vector<VerDef>>
ELFFile<ELFT>::getVersionDefinitions(const Elf_Shdr &Sec) const { … }
template <class ELFT>
Expected<std::vector<VerNeed>>
ELFFile<ELFT>::getVersionDependencies(const Elf_Shdr &Sec,
WarningHandler WarnHandler) const { … }
template <class ELFT>
Expected<const typename ELFT::Shdr *>
ELFFile<ELFT>::getSection(uint32_t Index) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getStringTable(const Elf_Shdr &Section,
WarningHandler WarnHandler) const { … }
template <class ELFT>
Expected<ArrayRef<typename ELFT::Word>>
ELFFile<ELFT>::getSHNDXTable(const Elf_Shdr &Section) const { … }
template <class ELFT>
Expected<ArrayRef<typename ELFT::Word>>
ELFFile<ELFT>::getSHNDXTable(const Elf_Shdr &Section,
Elf_Shdr_Range Sections) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getStringTableForSymtab(const Elf_Shdr &Sec) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getStringTableForSymtab(const Elf_Shdr &Sec,
Elf_Shdr_Range Sections) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getLinkAsStrtab(const typename ELFT::Shdr &Sec) const { … }
template <class ELFT>
Expected<StringRef>
ELFFile<ELFT>::getSectionName(const Elf_Shdr &Section,
WarningHandler WarnHandler) const { … }
template <class ELFT>
Expected<StringRef> ELFFile<ELFT>::getSectionName(const Elf_Shdr &Section,
StringRef DotShstrtab) const { … }
inline uint32_t hashSysV(StringRef SymbolName) { … }
inline uint32_t hashGnu(StringRef Name) { … }
extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile<ELF32LE>;
extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile<ELF32BE>;
extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile<ELF64LE>;
extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile<ELF64BE>;
}
}
#endif