32 #include <system_error> 46 {
"Unknown",
"<unknown>: 7", 7},
47 {
"Unknown",
"<unknown>: 8", 8},
48 {
"Unknown",
"<unknown>: 9", 9},
50 {
"OS Specific",
"<OS specific>: 11", 11},
51 {
"OS Specific",
"<OS specific>: 12", 12},
52 {
"Proc Specific",
"<processor specific>: 13", 13},
53 {
"Proc Specific",
"<processor specific>: 14", 14},
54 {
"Proc Specific",
"<processor specific>: 15", 15}
66 return std::make_unique<ELFObjectFile<ELFT>>(std::move(*
Ret));
71 std::pair<unsigned char, unsigned char> Ident =
73 std::size_t MaxAlignment =
81 return createPtr<ELF32LE>(Obj);
83 return createPtr<ELF32BE>(Obj);
88 return createPtr<ELF64LE>(Obj);
90 return createPtr<ELF64BE>(Obj);
366 Triple +=
"v8m.base";
369 Triple +=
"v8m.main";
372 Triple +=
"v8.1m.main";
382 std::vector<std::pair<DataRefImpl, uint64_t>>
389 uint64_t JumpSlotReloc = 0;
392 JumpSlotReloc = ELF::R_386_JUMP_SLOT;
395 JumpSlotReloc = ELF::R_X86_64_JUMP_SLOT;
398 JumpSlotReloc = ELF::R_AARCH64_JUMP_SLOT;
403 std::unique_ptr<const MCInstrInfo> MII(
T->createMCInstrInfo());
404 std::unique_ptr<const MCInstrAnalysis> MIA(
405 T->createMCInstrAnalysis(MII.get()));
419 else if (Name ==
".rela.plt" || Name ==
".rel.plt")
421 else if (Name ==
".got.plt")
424 if (!Plt || !RelaPlt || !GotPlt)
431 auto PltEntries = MIA->findPltEntries(Plt->getAddress(),
433 GotPlt->getAddress(),
Triple);
436 for (
const auto &
Entry : PltEntries)
440 std::vector<std::pair<DataRefImpl, uint64_t>> Result;
441 for (
const auto &Relocation : RelaPlt->relocations()) {
442 if (Relocation.getType() != JumpSlotReloc)
444 auto PltEntryIter = GotToPlt.
find(Relocation.getOffset());
445 if (PltEntryIter != GotToPlt.
end())
446 Result.push_back(std::make_pair(
447 Relocation.getSymbol()->getRawDataRefImpl(), PltEntryIter->second));
bool hasAttribute(unsigned Tag) const
virtual uint16_t getEMachine() const =0
This class represents lattice values for constants.
SubtargetFeatures getFeatures() const override
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Triple makeTriple() const
Create a triple from the data in this object file.
This class is the base class for all object file types.
ArrayRef< uint8_t > arrayRefFromStringRef(StringRef Input)
Construct a string ref from an array ref of unsigned chars.
Error takeError()
Take ownership of the stored error.
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
unsigned getAttributeValue(unsigned Tag) const
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void setARMSubArch(Triple &TheTriple) const override
StringRef getBuffer() const
Tagged union holding either a T or a Error.
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
static Error createError(const Twine &Err)
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
virtual Error getBuildAttributes(ARMAttributeParser &Attributes) const =0
std::pair< unsigned char, unsigned char > getElfArchType(StringRef Object)
section_iterator_range sections() const
const llvm::EnumEntry< unsigned > ElfSymbolTypes[NumElfSymbolTypes]
constexpr int NumElfSymbolTypes
const std::string & str() const
iterator find(const_arg_type_t< KeyT > Val)
std::vector< std::pair< DataRefImpl, uint64_t > > getPltAddresses() const
The instances of the Type class are immutable: once they are created, they are never changed...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Expected< std::unique_ptr< ObjectFile > > createELFObjectFile(MemoryBufferRef Object)
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
static Expected< ELFObjectFile< ELFT > > create(MemoryBufferRef Object)
void consumeError(Error Err)
Consume a Error without doing anything.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isLittleEndian() const
ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source)
Triple - Helper class for working with autoconf configuration names.
virtual unsigned getPlatformFlags() const =0
Returns platform-specific object flags, if any.
Manages the enabling and disabling of subtarget specific features.
SubtargetFeatures getMIPSFeatures() const
static Expected< std::unique_ptr< ELFObjectFile< ELFT > > > createPtr(MemoryBufferRef Object)
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
const char * getBufferStart() const
Lightweight error class with error context and mandatory checking.
SubtargetFeatures getARMFeatures() const
StringRef - Represent a constant reference to a string, i.e.
SubtargetFeatures getRISCVFeatures() const
This is a value type class that represents a single section in the list of sections in the object fil...