33 #include <system_error> 48 return make_unique<ELFObjectFile<ELFT>>(std::move(*
Ret));
53 std::pair<unsigned char, unsigned char> Ident =
55 std::size_t MaxAlignment =
63 return createPtr<ELF32LE>(Obj);
65 return createPtr<ELF32BE>(Obj);
70 return createPtr<ELF64LE>(Obj);
72 return createPtr<ELF64BE>(Obj);
333 std::vector<std::pair<DataRefImpl, uint64_t>>
340 uint64_t JumpSlotReloc = 0;
343 JumpSlotReloc = ELF::R_386_JUMP_SLOT;
346 JumpSlotReloc = ELF::R_X86_64_JUMP_SLOT;
349 JumpSlotReloc = ELF::R_AARCH64_JUMP_SLOT;
354 std::unique_ptr<const MCInstrInfo> MII(
T->createMCInstrInfo());
355 std::unique_ptr<const MCInstrAnalysis> MIA(
356 T->createMCInstrAnalysis(MII.get()));
366 else if (Name ==
".rela.plt" || Name ==
".rel.plt")
368 else if (Name ==
".got.plt")
371 if (!Plt || !RelaPlt || !GotPlt)
374 if (Plt->getContents(PltContents))
378 auto PltEntries = MIA->findPltEntries(Plt->getAddress(), PltBytes,
379 GotPlt->getAddress(),
Triple);
382 for (
const auto &Entry : PltEntries)
383 GotToPlt.
insert(std::make_pair(Entry.second, Entry.first));
386 std::vector<std::pair<DataRefImpl, uint64_t>> Result;
387 for (
const auto &Relocation : RelaPlt->relocations()) {
388 if (Relocation.getType() != JumpSlotReloc)
390 auto PltEntryIter = GotToPlt.
find(Relocation.getOffset());
391 if (PltEntryIter != GotToPlt.
end())
392 Result.push_back(std::make_pair(
393 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
Triple makeTriple() const
Create a triple from the data in this object file.
const FeatureBitset Features
This class is the base class for all object file types.
static Error createError(StringRef Err)
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
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
virtual std::error_code getBuildAttributes(ARMAttributeParser &Attributes) const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
std::pair< unsigned char, unsigned char > getElfArchType(StringRef Object)
section_iterator_range sections() const
const std::string & str() const
iterator find(const_arg_type_t< KeyT > Val)
std::vector< std::pair< DataRefImpl, uint64_t > > getPltAddresses() const
std::size_t 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...
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)
#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...