13#ifndef LLVM_EXECUTIONENGINE_JITLINK_SYSTEMZ_H
14#define LLVM_EXECUTIONENGINE_JITLINK_SYSTEMZ_H
546 const Symbol *GOTSymbol) {
549 char *BlockWorkingMem =
B.getAlreadyMutableContent().data();
550 char *FixupPtr = BlockWorkingMem + E.getOffset();
552 int64_t S = E.getTarget().getAddress().getValue();
553 int64_t
A = E.getAddend();
556 Edge::Kind K = E.getKind();
559 dbgs() <<
" Applying fixup on " <<
G.getEdgeKindName(K)
560 <<
" edge, (S, A, P, .GOT.) = (" <<
formatv(
"{0:x}", S) <<
", "
562 <<
formatv(
"{0:x}", GOTBase) <<
")\n";
587 ((
Value & 0xFFF) << 16) | ((
Value & 0xFF000) >> 4));
656 FixupPtr[0] =
Value >> 17;
657 FixupPtr[1] =
Value >> 9;
658 FixupPtr[2] =
Value >> 1;
683 assert(GOTSymbol &&
"No GOT section symbol");
684 int64_t
Value = GOTBase +
A -
P;
691 assert(GOTSymbol &&
"No GOT section symbol");
692 int64_t
Value = GOTBase +
A -
P;
702 assert(GOTSymbol &&
"No GOT section symbol");
703 int64_t
Value = S +
A - GOTBase;
709 assert(GOTSymbol &&
"No GOT section symbol");
710 int64_t
Value = S +
A - GOTBase;
718 assert(GOTSymbol &&
"No GOT section symbol");
719 int64_t
Value = S +
A - GOTBase;
726 assert(GOTSymbol &&
"No GOT section symbol");
731 ((
Value & 0xFFF) << 16) | ((
Value & 0xFF000) >> 4));
735 assert(GOTSymbol &&
"No GOT section symbol");
744 "In graph " +
G.getName() +
", section " +
B.getSection().getName() +
768 return {
reinterpret_cast<const char *
>(StubContent),
StubEntrySize};
777 Symbol *InitialTarget =
nullptr,
782 B.addEdge(
Pointer64, 0, *InitialTarget, InitialAddend);
783 return G.addAnonymousSymbol(
B, 0,
G.getPointerSize(),
false,
false);
806 return G.addAnonymousSymbol(
817 if (E.getTarget().isDefined())
819 Edge::Kind KindToSet = Edge::Invalid;
820 switch (E.getKind()) {
842 assert(KindToSet != Edge::Invalid &&
843 "Fell through switch, but no new kind to set");
845 dbgs() <<
" Fixing " <<
G.getEdgeKindName(E.getKind()) <<
" edge at "
846 <<
B->getFixupAddress(E) <<
" (" <<
B->getAddress() <<
" + "
847 <<
formatv(
"{0:x}", E.getOffset()) <<
")\n";
849 E.setKind(KindToSet);
877 if (E.getTarget().isDefined())
880 switch (E.getKind()) {
895 dbgs() <<
" Fixing " <<
G.getEdgeKindName(E.getKind()) <<
" edge at "
896 <<
B->getFixupAddress(E) <<
" (" <<
B->getAddress() <<
" + "
897 <<
formatv(
"{0:x}", E.getOffset()) <<
")\n";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_UNLIKELY(EXPR)
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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)
Global Offset Table Builder.
Symbol & createEntry(LinkGraph &G, Symbol &Target)
static StringRef getSectionName()
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
PLTTableManager(GOTTableManager &GOT)
bool visitEdge(LinkGraph &G, Block *B, Edge &E)
Section & getStubsSection(LinkGraph &G)
static StringRef getSectionName()
Symbol & createEntry(LinkGraph &G, Symbol &Target)
Represents an address in the executor process.
uint64_t getValue() const
ArrayRef< char > getGOTEntryBlockContent(LinkGraph &G)
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...
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 NullPointerContent[8]
SystemZ null pointer content.
EdgeKind_systemz
Represents systemz fixups and other systemz-specific edge kinds.
@ DeltaPLT32
A 32-bit Delta.
@ Delta64PLTFromGOT
A 64-bit offset from GOT to PLT.
@ Pointer16
A plain 16-bit pointer value relocation.
@ RequestGOTAndTransformToDelta32FromGOT
A GOT entry getter/constructor, transformed to Delta32FromGOT pointing at the GOT entry for the origi...
@ RequestGOTAndTransformToDelta32dbl
A GOT entry getter/constructor, transformed to Delta32dbl pointing at the GOT entry for the original ...
@ Pointer64
A plain 64-bit pointer value relocation.
@ Pointer20
A plain 20-bit pointer value relocation.
@ RequestGOTAndTransformToDelta16FromGOT
A GOT entry getter/constructor, transformed to Delta16FromGOT pointing at the GOT entry for the origi...
@ RequestGOTAndTransformToDelta12FromGOT
A GOT entry getter/constructor, transformed to Delta12FromGOT pointing at the GOT entry for the origi...
@ RequestGOTAndTransformToDelta64FromGOT
A GOT entry getter/constructor, transformed to Delta64FromGOT pointing at the GOT entry for the origi...
@ DeltaPLT16dbl
A 16-bit Delta shifted by 1.
@ Delta20FromGOT
A 20-bit offset from GOT.
@ Delta16FromGOT
A 16-bit offset from GOT.
@ Pointer8
A plain 8-bit pointer value relocation.
@ Delta16PLTFromGOT
A 16-bit offset from GOT to PLT.
@ NegDelta64
A 64-bit negative delta.
@ Delta32PLTFromGOT
A 32-bit offset from GOT to PLT.
@ Delta32dblGOTBase
A 32-bit Delta to GOT base shifted by 1.
@ Delta32FromGOT
A 32-bit offset from GOT.
@ Delta32GOTBase
A 32-bit Delta to GOT base.
@ DeltaPLT12dbl
A 12-bit Delta shifted by 1.
@ RequestGOTAndTransformToDelta20FromGOT
A GOT entry getter/constructor, transformed to Delta20FromGOT pointing at the GOT entry for the origi...
@ Delta16dbl
A 16-bit delta shifted by 1.
@ Delta12FromGOT
A 12-bit offset from GOT.
@ DeltaPLT32dbl
A 32-bit Delta shifted by 1.
@ NegDelta32
A 32-bit negative delta.
@ Delta24dbl
A 24-bit delta shifted by 1.
@ DeltaPLT64
A 64-bit Delta.
@ DeltaPLT24dbl
A 24-bit Delta shifted by 1.
@ Pointer12
A plain 12-bit pointer value relocation.
@ Delta12dbl
A 12-bit delta shifted by 1.
@ Pointer32
A plain 32-bit pointer value relocation.
@ Delta32dbl
A 32-bit delta shifted by 1.
@ Delta64FromGOT
A 64-bit offset from GOT.
const char * getEdgeKindName(Edge::Kind K)
Returns a string name for the given systemz edge.
Block & createPointerJumpStubBlock(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
Create a jump stub block that jumps via the pointer at the given symbol.
constexpr size_t StubEntrySize
SystemZ pointer jump stub content.
ArrayRef< char > getStubBlockContent(LinkGraph &G)
const char Pointer64JumpStubContent[StubEntrySize]
LLVM_ABI 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.
LLVM_ABI Error makeAlignmentError(llvm::orc::ExecutorAddr Loc, uint64_t Value, int N, const Edge &E)
static bool isAlignmentCorrect(uint64_t Value, int N)
void write16be(void *P, uint16_t V)
void write32be(void *P, uint32_t V)
uint32_t read32be(const void *P)
void write64be(void *P, uint64_t V)
uint16_t read16be(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.