14 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H
15 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H
19 #include "../RuntimeDyldCOFF.h"
21 #define DEBUG_TYPE "dyld"
44 auto Symbol = RelI->getSymbol();
53 auto SectionOrErr =
Symbol->getSection();
55 return SectionOrErr.takeError();
58 uint64_t RelType = RelI->getType();
59 uint64_t
Offset = RelI->getOffset();
65 uint8_t *Displacement = (uint8_t *)ObjTarget;
81 RelI->getTypeName(RelTypeName);
83 DEBUG(
dbgs() <<
"\t\tIn Section " << SectionID <<
" Offset " << Offset
84 <<
" RelType: " << RelTypeName <<
" TargetName: " << TargetName
85 <<
" Addend " << Addend <<
"\n");
87 unsigned TargetSectionID = -1;
89 RelocationEntry RE(SectionID, Offset, RelType, 0, -1, 0, 0, 0,
false, 0);
92 if (
auto TargetSectionIDOrErr =
94 TargetSectionID = *TargetSectionIDOrErr;
96 return TargetSectionIDOrErr.takeError();
147 assert(static_cast<int32_t>(Result) <= INT32_MAX &&
148 "relocation overflow");
149 assert(static_cast<int32_t>(Result) >= INT32_MIN &&
150 "relocation underflow");
152 <<
" RelType: IMAGE_REL_I386_DIR32"
154 <<
" Value: " <<
format(
"0x%08" PRIx32, Result) <<
'\n');
164 assert(static_cast<int32_t>(Result) <= INT32_MAX &&
165 "relocation overflow");
166 assert(static_cast<int32_t>(Result) >= INT32_MIN &&
167 "relocation underflow");
169 <<
" RelType: IMAGE_REL_I386_DIR32NB"
171 <<
" Value: " <<
format(
"0x%08" PRIx32, Result) <<
'\n');
181 assert(static_cast<int32_t>(Result) <= INT32_MAX &&
182 "relocation overflow");
183 assert(static_cast<int32_t>(Result) >= INT32_MIN &&
184 "relocation underflow");
186 <<
" RelType: IMAGE_REL_I386_REL32"
188 <<
" Value: " <<
format(
"0x%08" PRIx32, Result) <<
'\n');
195 "relocation overflow");
197 "relocation underflow");
199 <<
" RelType: IMAGE_REL_I386_SECTION Value: " << RE.
SectionID
206 "relocation overflow");
208 "relocation underflow");
210 <<
" RelType: IMAGE_REL_I386_SECREL Value: " << RE.
Addend
RelocationEntry - used to represent relocations internally in the dynamic linker. ...
void writeBytesUnaligned(uint64_t Value, uint8_t *Dst, unsigned Size) const
Endian-aware write.
Expected< 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 ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
uintptr_t getObjAddress() const
This class is the base class for all object file types.
uint64_t getSymbolOffset(const SymbolRef &Sym)
Error takeError()
Take ownership of the stored error.
unsigned getStubAlignment() override
unsigned SectionID
SectionID - the section this relocation points to.
std::map< RelocationValueRef, uintptr_t > StubMap
Tagged union holding either a T or a Error.
void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override
A object file specific relocation resolver.
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName)
void deregisterEHFrames() override
RuntimeDyldCOFFI386(RuntimeDyld::MemoryManager &MM, JITSymbolResolver &Resolver)
void addRelocationForSection(const RelocationEntry &RE, unsigned SectionID)
uint64_t readBytesUnaligned(uint8_t *Src, unsigned Size) const
Endian-aware read Read the least significant Size bytes from Src.
unsigned getMaxStubSize() override
virtual basic_symbol_iterator symbol_end() const =0
Expected< unsigned > findOrEmitSection(const ObjectFile &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
Find Section in LocalSections.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void registerEHFrames() override
int64_t Addend
Addend - the relocation addend encoded in the instruction itself.
uint32_t RelType
RelType - relocation type.
JITSymbolResolver & Resolver
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
uint64_t Offset
Offset - offset into the section.
virtual section_iterator section_end() const =0
std::map< SectionRef, unsigned > ObjSectionToIDMap
SectionEntry - represents a section emitted into memory by the dynamic linker.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
StringRef - Represent a constant reference to a string, i.e.