13#ifndef LLVM_EXECUTIONENGINE_JITLINK_I386_H
14#define LLVM_EXECUTIONENGINE_JITLINK_I386_H
186 const Symbol *GOTSymbol) {
187 using namespace i386;
190 char *BlockWorkingMem =
B.getAlreadyMutableContent().data();
191 char *FixupPtr = BlockWorkingMem +
E.getOffset();
192 auto FixupAddress =
B.getAddress() +
E.getOffset();
194 switch (
E.getKind()) {
200 uint32_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
206 int32_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
212 uint32_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
221 int32_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
230 int32_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
236 assert(GOTSymbol &&
"No GOT section symbol");
238 E.getTarget().getAddress() - GOTSymbol->
getAddress() +
E.getAddend();
246 int32_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
252 return make_error<JITLinkError>(
253 "In graph " +
G.getName() +
", section " +
B.getSection().getName() +
284 Symbol *InitialTarget =
nullptr,
289 B.addEdge(
Pointer32, 0, *InitialTarget, InitialAddend);
290 return G.addAnonymousSymbol(
B, 0,
PointerSize,
false,
false);
307 2, PointerSymbol, 0);
318 return G.addAnonymousSymbol(
330 switch (
E.getKind()) {
344 "Fell through switch, but no new kind to set");
346 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
347 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
348 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
350 E.setKind(KindToSet);
379 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
380 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
381 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_LIKELY(EXPR)
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
LLVM Value Representation.
An Addressable with content and edges.
Represents fixups and constraints in the LinkGraph.
Represents an object file section.
orc::ExecutorAddr getAddress() const
Returns the address of this symbol.
A CRTP base for tables that are built on demand, e.g.
Symbol & getEntryForTarget(LinkGraph &G, Symbol &Target)
Return the constructed entry.
Global Offset Table Builder.
Symbol & createEntry(LinkGraph &G, Symbol &Target)
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
static StringRef getSectionName()
Procedure Linkage Table Builder.
static StringRef getSectionName()
Symbol & createEntry(LinkGraph &G, Symbol &Target)
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
Section & getStubsSection(LinkGraph &G)
PLTTableManager(GOTTableManager &GOT)
Represents an address in the executor process.
Block & createPointerJumpStubBlock(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
Create a jump stub block that jumps via the pointer at the given symbol.
Error applyFixup(LinkGraph &G, Block &B, const Edge &E, const Symbol *GOTSymbol)
Apply fixup expression for edge to block content.
Symbol & createAnonymousPointerJumpStub(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
Create a jump stub that jumps via the pointer at the given symbol and an anonymous symbol pointing to...
constexpr uint32_t PointerSize
i386 pointer size.
Error optimizeGOTAndStubAccesses(LinkGraph &G)
Optimize the GOT and Stub relocations if the edge target address is in range.
const char PointerJumpStubContent[6]
i386 pointer jump stub content.
EdgeKind_i386
Represets i386 fixups.
@ BranchPCRel32ToPtrJumpStubBypassable
A relaxable version of BranchPCRel32ToPtrJumpStub.
@ Delta32FromGOT
A 32-bit GOT delta.
@ PCRel32
A 32-bit PC-relative relocation.
@ BranchPCRel32ToPtrJumpStub
A 32-bit PC-relative branch to a pointer jump stub.
@ PCRel16
A 16-bit PC-relative relocation.
@ RequestGOTAndTransformToDelta32FromGOT
A GOT entry offset within GOT getter/constructor, transformed to Delta32FromGOT pointing at the GOT e...
@ BranchPCRel32
A 32-bit PC-relative branch.
@ Pointer32
A plain 32-bit pointer value relocation.
@ Pointer16
A plain 16-bit pointer value relocation.
const char NullPointerContent[PointerSize]
i386 null pointer content.
Symbol & createAnonymousPointer(LinkGraph &G, Section &PointerSection, Symbol *InitialTarget=nullptr, uint64_t InitialAddend=0)
Creates a new pointer block in the given section and returns an anonymous symbol pointing to it.
const char * getEdgeKindName(Edge::Kind K)
Returns a string name for the given i386 edge.
Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B, const Edge &E)
Create an out of range error for the given edge in the given block.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.