13#ifndef LLVM_EXECUTIONENGINE_JITLINK_I386_H
14#define LLVM_EXECUTIONENGINE_JITLINK_I386_H
198 const Symbol *GOTSymbol) {
199 using namespace i386;
202 char *BlockWorkingMem =
B.getAlreadyMutableContent().data();
203 char *FixupPtr = BlockWorkingMem +
E.getOffset();
204 auto FixupAddress =
B.getAddress() +
E.getOffset();
206 switch (
E.getKind()) {
212 uint32_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
219 E.getTarget().getAddress() - (FixupAddress + 4) +
E.getAddend();
225 uint32_t Value =
E.getTarget().getAddress().getValue() +
E.getAddend();
235 E.getTarget().getAddress() - (FixupAddress + 4) +
E.getAddend();
244 int32_t
Value =
E.getTarget().getAddress() - FixupAddress +
E.getAddend();
250 assert(GOTSymbol &&
"No GOT section symbol");
252 E.getTarget().getAddress() - GOTSymbol->
getAddress() +
E.getAddend();
261 E.getTarget().getAddress() - (FixupAddress + 4) +
E.getAddend();
267 return make_error<JITLinkError>(
268 "In graph " +
G.getName() +
", section " +
B.getSection().getName() +
299 Symbol *InitialTarget =
nullptr,
304 B.addEdge(
Pointer32, 0, *InitialTarget, InitialAddend);
305 return G.addAnonymousSymbol(
B, 0,
PointerSize,
false,
false);
322 2, PointerSymbol, 0);
333 return G.addAnonymousSymbol(
345 switch (
E.getKind()) {
359 "Fell through switch, but no new kind to set");
361 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
362 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
363 <<
formatv(
"{0:x}",
E.getOffset()) <<
")\n";
365 E.setKind(KindToSet);
394 dbgs() <<
" Fixing " <<
G.getEdgeKindName(
E.getKind()) <<
" edge at "
395 <<
B->getFixupAddress(
E) <<
" (" <<
B->getAddress() <<
" + "
396 <<
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, X)
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(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.