14 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H 15 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H 17 #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 LLVM_DEBUG(
dbgs() <<
"\t\tIn Section " << SectionID <<
" Offset " << Offset
84 <<
" RelType: " << RelTypeName <<
" TargetName: " 85 << TargetName <<
" 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(Result <= UINT32_MAX &&
"relocation overflow");
149 <<
" RelType: IMAGE_REL_I386_DIR32" 151 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
162 assert(Result <= UINT32_MAX &&
"relocation overflow");
164 <<
" RelType: IMAGE_REL_I386_DIR32NB" 166 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
177 assert(static_cast<int64_t>(Result) <= INT32_MAX &&
178 "relocation overflow");
179 assert(static_cast<int64_t>(Result) >= INT32_MIN &&
180 "relocation underflow");
182 <<
" RelType: IMAGE_REL_I386_REL32" 184 <<
" Value: " <<
format(
"0x%08" PRIx32, Result)
192 "relocation overflow");
194 <<
" RelType: IMAGE_REL_I386_SECTION Value: " 200 assert(static_cast<uint64_t>(RE.
Addend) <= UINT32_MAX &&
201 "relocation overflow");
203 <<
" RelType: IMAGE_REL_I386_SECREL Value: " RelocationEntry - used to represent relocations internally in the dynamic linker. ...
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.
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.
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.
unsigned getMaxStubSize() override
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.
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.