14 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFF86_64_H
15 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFF86_64_H
19 #include "../RuntimeDyldCOFF.h"
21 #define DEBUG_TYPE "dyld"
80 Value -= FinalAddress + Delta;
81 uint64_t Result = Value + RE.
Addend;
82 assert(((int64_t)Result <= INT32_MAX) &&
"Relocation overflow");
83 assert(((int64_t)Result >= INT32_MIN) &&
"Relocation underflow");
84 *TargetAddress = Result;
102 *TargetAddress = Value + RE.
Addend;
128 uint64_t RelType = RelI->getType();
129 uint64_t Offset = RelI->getOffset();
132 uintptr_t ObjTarget = Section.
ObjAddress + Offset;
143 uint32_t *Displacement = (uint32_t *)ObjTarget;
144 Addend = *Displacement;
149 uint64_t *Displacement = (uint64_t *)ObjTarget;
150 Addend = *Displacement;
159 if (std::error_code EC = TargetNameOrErr.
getError())
163 DEBUG(
dbgs() <<
"\t\tIn Section " << SectionID <<
" Offset " << Offset
164 <<
" RelType: " << RelType <<
" TargetName: " << TargetName
165 <<
" Addend " << Addend <<
"\n");
171 bool IsCode = SecI->isText();
172 unsigned TargetSectionID =
184 for (
auto const &EHFrameSID : UnregisteredEHFrameSections) {
185 uint8_t *EHFrameAddr =
Sections[EHFrameSID].Address;
186 uint64_t EHFrameLoadAddr =
Sections[EHFrameSID].LoadAddress;
187 size_t EHFrameSize =
Sections[EHFrameSID].Size;
189 RegisteredEHFrameSections.
push_back(EHFrameSID);
191 UnregisteredEHFrameSections.clear();
199 for (
const auto &SectionPair : SectionMap) {
205 if (Name ==
".xdata") {
206 UnregisteredEHFrameSections.
push_back(SectionPair.second);
RelocationEntry - used to represent relocations internally in the dynamic linker. ...
void push_back(const T &Elt)
std::error_code getError() const
Represents either an error or a value T.
relocation_iterator processRelocationRef(unsigned SectionID, relocation_iterator RelI, const ObjectFile &Obj, ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) override
Parses one or more object file relocations (some object files use relocation pairs) and stores it to ...
RuntimeDyld::MemoryManager & MemMgr
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 findOrEmitSection(const ObjectFile &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
Find Section in LocalSections.
uint64_t getSymbolOffset(const SymbolRef &Sym)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
void deregisterEHFrames() override
unsigned getStubAlignment() override
unsigned SectionID
SectionID - the section this relocation points to.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::map< RelocationValueRef, uintptr_t > StubMap
std::error_code getName(StringRef &Result) const
void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName)
RuntimeDyld::SymbolResolver & Resolver
void addRelocationForSection(const RelocationEntry &RE, unsigned SectionID)
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override
A object file specific relocation resolver.
basic_symbol_iterator symbol_end() const
RuntimeDyldCOFFX86_64(RuntimeDyld::MemoryManager &MM, RuntimeDyld::SymbolResolver &Resolver)
int64_t Addend
Addend - the relocation addend encoded in the instruction itself.
uint32_t RelType
RelType - relocation type.
void finalizeLoad(const ObjectFile &Obj, ObjSectionToIDMap &SectionMap) override
uint64_t TargetAddress
Represents an address in the target process's address space.
uintptr_t ObjAddress
ObjAddress - address of the section in the in-memory object file.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
ErrorOr< StringRef > getName() const
uint64_t Offset
Offset - offset into the section.
virtual section_iterator section_end() const =0
std::map< SectionRef, unsigned > ObjSectionToIDMap
std::error_code Check(std::error_code Err)
uint64_t LoadAddress
LoadAddress - the address of the section in the target process's memory.
SectionEntry - represents a section emitted into memory by the dynamic linker.
LLVM Value Representation.
StringRef - Represent a constant reference to a string, i.e.
virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size)=0
Register the EH frames with the runtime so that c++ exceptions work.
void registerEHFrames() override
std::error_code getSection(section_iterator &Result) const
Get section this symbol is defined in reference to.
This is a value type class that represents a single section in the list of sections in the object fil...
unsigned getMaxStubSize() override