LLVM 20.0.0git
|
Classes | |
class | GOTTableManager |
Global Offset Table Builder. More... | |
class | PLTTableManager |
Procedure Linkage Table Builder. More... | |
Enumerations | |
enum | EdgeKind_i386 : Edge::Kind { None = Edge::FirstRelocation , Pointer32 , PCRel32 , Pointer16 , PCRel16 , Delta32 , Delta32FromGOT , RequestGOTAndTransformToDelta32FromGOT , BranchPCRel32 , BranchPCRel32ToPtrJumpStub , BranchPCRel32ToPtrJumpStubBypassable } |
Represets i386 fixups. More... | |
Functions | |
const char * | getEdgeKindName (Edge::Kind K) |
Returns a string name for the given i386 edge. | |
Error | applyFixup (LinkGraph &G, Block &B, const Edge &E, const Symbol *GOTSymbol) |
Apply fixup expression for edge to block 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. | |
Block & | createPointerJumpStubBlock (LinkGraph &G, Section &StubSection, Symbol &PointerSymbol) |
Create a jump stub block that jumps via the pointer at the given symbol. | |
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 it. | |
Error | optimizeGOTAndStubAccesses (LinkGraph &G) |
Optimize the GOT and Stub relocations if the edge target address is in range. | |
Variables | |
constexpr uint32_t | PointerSize = 4 |
i386 pointer size. | |
const char | NullPointerContent [PointerSize] = {0x00, 0x00, 0x00, 0x00} |
i386 null pointer content. | |
const char | PointerJumpStubContent [6] |
i386 pointer jump stub content. | |
Represets i386 fixups.
Enumerator | |
---|---|
None | None. |
Pointer32 | A plain 32-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint32 Errors:
|
PCRel32 | A 32-bit PC-relative relocation. Represents a data/control flow instruction using PC-relative addressing to a target. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
Pointer16 | A plain 16-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint16 Errors:
|
PCRel16 | A 16-bit PC-relative relocation. Represents a data/control flow instruction using PC-relative addressing to a target. Fixup expression: Fixup <- Target - Fixup + Addend : int16 Errors:
|
Delta32 | A 32-bit delta. Delta from the fixup to the target. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
Delta32FromGOT | A 32-bit GOT delta. Delta from the global offset table to the target. Fixup expression: Fixup <- Target - GOTSymbol + Addend : int32 Errors:
|
RequestGOTAndTransformToDelta32FromGOT | A GOT entry offset within GOT getter/constructor, transformed to Delta32FromGOT pointing at the GOT entry for the original target. Indicates that this edge should be transformed into a Delta32FromGOT targeting the GOT entry for the edge's current target, maintaining the same addend. A GOT entry for the target should be created if one does not already exist. Edges of this kind are usually handled by a GOT builder pass inserted by default Fixup expression: NONE Errors:
|
BranchPCRel32 | A 32-bit PC-relative branch. Represents a PC-relative call or branch to a target. This can be used to identify, record, and/or patch call sites. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
BranchPCRel32ToPtrJumpStub | A 32-bit PC-relative branch to a pointer jump stub. The target of this relocation should be a pointer jump stub of the form: .text
jmp *tgtptr
; ...
.data
tgtptr:
.quad 0
This edge kind has the same fixup expression as BranchPCRel32, but further identifies the call/branch as being to a pointer jump stub. For edges of this kind the jump stub should not be bypassed (use BranchPCRel32ToPtrJumpStubBypassable for that), but the pointer location target may be recorded to allow manipulation at runtime. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
BranchPCRel32ToPtrJumpStubBypassable | A relaxable version of BranchPCRel32ToPtrJumpStub. The edge kind has the same fixup expression as BranchPCRel32ToPtrJumpStub, but identifies the call/branch as being to a pointer jump stub that may be bypassed with a direct jump to the ultimate target if the ultimate target is within range of the fixup location. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
|
inline |
Apply fixup expression for edge to block content.
Definition at line 185 of file i386.h.
References assert(), B, BranchPCRel32, BranchPCRel32ToPtrJumpStub, BranchPCRel32ToPtrJumpStubBypassable, Delta32, Delta32FromGOT, E, G, llvm::jitlink::Symbol::getAddress(), getEdgeKindName(), LLVM_LIKELY, llvm::jitlink::makeTargetOutOfRangeError(), None, PCRel16, PCRel32, Pointer16, Pointer32, and llvm::Error::success().
|
inline |
Creates a new pointer block in the given section and returns an anonymous symbol pointing to it.
If InitialTarget is given then an Pointer32 relocation will be added to the block pointing at InitialTarget.
The pointer block will have the following default values: alignment: 32-bit alignment-offset: 0 address: highest allowable (~7U)
Definition at line 283 of file i386.h.
References B, G, NullPointerContent, Pointer32, and PointerSize.
Referenced by llvm::jitlink::i386::GOTTableManager::createEntry().
|
inline |
Create a jump stub that jumps via the pointer at the given symbol and an anonymous symbol pointing to it.
Return the anonymous symbol.
The stub block will be created by createPointerJumpStubBlock.
Definition at line 315 of file i386.h.
References createPointerJumpStubBlock(), and G.
Referenced by llvm::jitlink::i386::PLTTableManager::createEntry().
|
inline |
Create a jump stub block that jumps via the pointer at the given symbol.
The stub block will have the following default values: alignment: 8-bit alignment-offset: 0 address: highest allowable: (~5U)
Definition at line 299 of file i386.h.
References B, G, Pointer32, and PointerJumpStubContent.
Referenced by createAnonymousPointerJumpStub().
const char * llvm::jitlink::i386::getEdgeKindName | ( | Edge::Kind | K | ) |
Returns a string name for the given i386 edge.
For debugging purposes only
Definition at line 19 of file i386.cpp.
References BranchPCRel32, BranchPCRel32ToPtrJumpStub, BranchPCRel32ToPtrJumpStubBypassable, Delta32, Delta32FromGOT, llvm::jitlink::getGenericEdgeKindName(), None, PCRel16, PCRel32, Pointer16, Pointer32, and RequestGOTAndTransformToDelta32FromGOT.
Referenced by applyFixup(), and optimizeGOTAndStubAccesses().
Optimize the GOT and Stub relocations if the edge target address is in range.
Definition at line 53 of file i386.cpp.
References assert(), B, BranchPCRel32, BranchPCRel32ToPtrJumpStubBypassable, llvm::dbgs(), E, G, getEdgeKindName(), LLVM_DEBUG, PointerJumpStubContent, llvm::jitlink::printEdge(), and llvm::Error::success().
i386 null pointer content.
Definition at line 48 of file i386.cpp.
Referenced by createAnonymousPointer().
i386 pointer jump stub content.
Contains the instruction sequence for an indirect jump via an in-memory pointer: jmpq *ptr
Definition at line 50 of file i386.cpp.
Referenced by createPointerJumpStubBlock(), and optimizeGOTAndStubAccesses().
|
constexpr |