10 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDMACHOX86_64_H
11 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDMACHOX86_64_H
13 #include "../RuntimeDyldMachO.h"
15 #define DEBUG_TYPE "dyld"
44 "Scattered relocations not supported on X86_64");
52 if (!IsExtern && RE.IsPCRel)
57 processGOTRelocation(RE, Value, Stubs);
80 Value -= FinalAddress + 4;
98 Error(
"Relocation type not implemented yet!");
110 assert(RE.
Size == 2);
112 RuntimeDyldMachO::StubMap::const_iterator i = Stubs.find(Value);
114 if (i != Stubs.end()) {
115 Addr = Section.
Address + i->second;
RelocationEntry - used to represent relocations internally in the dynamic linker. ...
bool getPlainRelocationExternal(const MachO::any_relocation_info &RE) const
void writeBytesUnaligned(uint64_t Value, uint8_t *Dst, unsigned Size) const
Endian-aware write.
This class is the base class for all object file types.
uint8_t * Address
Address - address in the linker's memory where the section resides.
unsigned getMaxStubSize() override
void finalizeSection(const ObjectFile &Obj, unsigned SectionID, const SectionRef &Section)
bool IsPCRel
True if this is a PCRel relocation (MachO specific).
unsigned SectionID
SectionID - the section this relocation points to.
RelocationEntry getRelocationEntry(unsigned SectionID, const ObjectFile &BaseTObj, const relocation_iterator &RI) const
Given a relocation_iterator for a non-scattered relocation, construct a RelocationEntry and fill in t...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
int64_t memcpyAddend(const RelocationEntry &RE) const
This convenience method uses memcpy to extract a contiguous addend (the addend size and offset are ta...
std::map< RelocationValueRef, uintptr_t > StubMap
uintptr_t StubOffset
StubOffset - used for architectures with stub functions for far relocations (like ARM)...
void dumpRelocationToResolve(const RelocationEntry &RE, uint64_t Value) const
Dump information about the relocation entry (RE) and resolved value.
RuntimeDyldMachOTarget - Templated base class for generic MachO linker algorithms and data structures...
bool Error(const Twine &Msg)
void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName)
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const
RuntimeDyld::SymbolResolver & Resolver
void addRelocationForSection(const RelocationEntry &RE, unsigned SectionID)
relocation_iterator processRelocationRef(unsigned SectionID, relocation_iterator RelI, const ObjectFile &BaseObjT, ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) override
Parses one or more object file relocations (some object files use relocation pairs) and stores it to ...
int64_t Addend
Addend - the relocation addend encoded in the instruction itself.
uint32_t RelType
RelType - relocation type.
RuntimeDyldMachOX86_64(RuntimeDyld::MemoryManager &MM, RuntimeDyld::SymbolResolver &Resolver)
unsigned getStubAlignment() override
uint64_t Offset
Offset - offset into the section.
std::map< SectionRef, unsigned > ObjSectionToIDMap
RelocationValueRef getRelocationValueRef(const ObjectFile &BaseTObj, const relocation_iterator &RI, const RelocationEntry &RE, ObjSectionToIDMap &ObjSectionToID)
Construct a RelocationValueRef representing the relocation target.
uint64_t LoadAddress
LoadAddress - the address of the section in the target process's memory.
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override
A object file specific relocation resolver.
SectionEntry - represents a section emitted into memory by the dynamic linker.
LLVM Value Representation.
unsigned Size
The size of this relocation (MachO specific).
void makeValueAddendPCRel(RelocationValueRef &Value, const relocation_iterator &RI, unsigned OffsetToNextPC)
Make the RelocationValueRef addend PC-relative.
bool isRelocationScattered(const MachO::any_relocation_info &RE) const
This is a value type class that represents a single section in the list of sections in the object fil...