13 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H 14 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H 16 #include "../RuntimeDyldCOFF.h" 20 #define DEBUG_TYPE "dyld" 43 auto Symbol = RelI->getSymbol();
52 auto SectionOrErr =
Symbol->getSection();
54 return SectionOrErr.takeError();
57 uint64_t RelType = RelI->getType();
58 uint64_t
Offset = RelI->getOffset();
64 uint8_t *Displacement = (uint8_t *)ObjTarget;
80 RelI->getTypeName(RelTypeName);
82 LLVM_DEBUG(
dbgs() <<
"\t\tIn Section " << SectionID <<
" Offset " << Offset
83 <<
" RelType: " << RelTypeName <<
" TargetName: " 84 << TargetName <<
" Addend " << Addend <<
"\n");
86 unsigned TargetSectionID = -1;
88 RelocationEntry RE(SectionID, Offset, RelType, 0, -1, 0, 0, 0,
false, 0);
91 if (
auto TargetSectionIDOrErr =
93 TargetSectionID = *TargetSectionIDOrErr;
95 return TargetSectionIDOrErr.takeError();
146 assert(Result <= UINT32_MAX &&
"relocation overflow");
148 <<
" RelType: IMAGE_REL_I386_DIR32" 150 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
161 assert(Result <= UINT32_MAX &&
"relocation overflow");
163 <<
" RelType: IMAGE_REL_I386_DIR32NB" 165 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
176 assert(static_cast<int64_t>(Result) <= INT32_MAX &&
177 "relocation overflow");
178 assert(static_cast<int64_t>(Result) >= INT32_MIN &&
179 "relocation underflow");
181 <<
" RelType: IMAGE_REL_I386_REL32" 183 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
191 "relocation overflow");
193 <<
" RelType: IMAGE_REL_I386_SECTION Value: " 199 assert(static_cast<uint64_t>(RE.
Addend) <= UINT32_MAX &&
200 "relocation overflow");
202 <<
" RelType: IMAGE_REL_I386_SECREL Value: " RelocationEntry - used to represent relocations internally in the dynamic linker. ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
uint64_t readBytesUnaligned(uint8_t *Src, unsigned Size) const
Endian-aware read Read the least significant Size bytes from Src.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
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
void writeBytesUnaligned(uint64_t Value, uint8_t *Dst, unsigned Size) const
Endian-aware write.
unsigned SectionID
SectionID - the section this relocation points to.
Expected< object::relocation_iterator > processRelocationRef(unsigned SectionID, object::relocation_iterator RelI, const object::ObjectFile &Obj, ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) override
Parses one or more object file relocations (some object files use relocation pairs) and stores it 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.
void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName)
RuntimeDyldCOFFI386(RuntimeDyld::MemoryManager &MM, JITSymbolResolver &Resolver)
void addRelocationForSection(const RelocationEntry &RE, unsigned SectionID)
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Symbol resolution interface.
virtual basic_symbol_iterator symbol_end() const =0
uintptr_t getObjAddress() const
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.
unsigned getMaxStubSize() const override
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.