LLVM 20.0.0git
|
Classes | |
class | GOTTableManager |
Global Offset Table Builder. More... | |
class | PLTTableManager |
Procedure Linkage Table Builder. More... | |
Enumerations | |
enum | EdgeKind_loongarch : Edge::Kind { Pointer64 = Edge::FirstRelocation , Pointer32 , Branch26PCRel , Delta32 , NegDelta32 , Delta64 , Page20 , PageOffset12 , RequestGOTAndTransformToPage20 , RequestGOTAndTransformToPageOffset12 } |
Represents loongarch fixups. More... | |
Functions | |
const char * | getEdgeKindName (Edge::Kind K) |
Returns a string name for the given loongarch edge. | |
uint32_t | extractBits (uint32_t Val, unsigned Hi, unsigned Lo) |
Error | applyFixup (LinkGraph &G, Block &B, const Edge &E) |
Apply fixup expression for edge to block content. | |
ArrayRef< char > | getGOTEntryBlockContent (LinkGraph &G) |
ArrayRef< char > | getStubBlockContent (LinkGraph &G) |
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. | |
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. | |
Variables | |
const char | NullPointerContent [8] |
loongarch null pointer content. | |
constexpr size_t | StubEntrySize = 12 |
loongarch stub content. | |
const uint8_t | LA64StubContent [StubEntrySize] |
const uint8_t | LA32StubContent [StubEntrySize] |
Represents loongarch fixups.
Enumerator | |
---|---|
Pointer64 | A plain 64-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint64 |
Pointer32 | A plain 32-bit pointer value relocation. Fixup expression: Fixup <- Target + Addend : uint32 Errors:
|
Branch26PCRel | A 26-bit PC-relative branch. Represents a PC-relative call or branch to a target within +/-128Mb. The target must be 4-byte aligned. Fixup expression: Fixup <- (Target - Fixup + Addend) >> 2 : int26 Notes: The '26' in the name refers to the number operand bits and follows the naming convention used by the corresponding ELF relocations. Since the low two bits must be zero (because of the 4-byte alignment of the target) the operand is effectively a signed 28-bit number. Errors:
|
Delta32 | A 32-bit delta. Delta from the fixup to the target. Fixup expression: Fixup <- Target - Fixup + Addend : int32 Errors:
|
NegDelta32 | A 32-bit negative delta. Delta from the target back to the fixup. Fixup expression: Fixup <- Fixup - Target + Addend : int32 Errors:
|
Delta64 | A 64-bit delta. Delta from the fixup to the target. Fixup expression: Fixup <- Target - Fixup + Addend : int64 |
Page20 | The signed 20-bit delta from the fixup page to the page containing the target. Fixup expression: Fixup <- (((Target + Addend + ((Target + Addend) & 0x800)) & ~0xfff) Notes: For PCALAU12I fixups. Errors:
|
PageOffset12 | The 12-bit offset of the target within its page. Typically used to fix up ADDI/LD_W/LD_D immediates. Fixup expression: Fixup <- ((Target + Addend) >> Shift) & 0xfff : int12 |
RequestGOTAndTransformToPage20 | A GOT entry getter/constructor, transformed to Page20 pointing at the GOT entry for the original target. Indicates that this edge should be transformed into a Page20 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/PLT builder pass inserted by default. Fixup expression: NONE Errors:
|
RequestGOTAndTransformToPageOffset12 | A GOT entry getter/constructor, transformed to Pageoffset12 pointing at the GOT entry for the original target. Indicates that this edge should be transformed into a PageOffset12 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/PLT builder pass inserted by default. Fixup expression: NONE |
Definition at line 25 of file loongarch.h.
Apply fixup expression for edge to block content.
Definition at line 173 of file loongarch.h.
References B, Branch26PCRel, Delta32, Delta64, E, extractBits(), G, getEdgeKindName(), llvm::jitlink::makeAlignmentError(), llvm::jitlink::makeTargetOutOfRangeError(), NegDelta32, Page20, PageOffset12, Pointer32, Pointer64, 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 Pointer64 relocation will be added to the block pointing at InitialTarget.
The pointer block will have the following default values: alignment: PointerSize alignment-offset: 0
Definition at line 291 of file loongarch.h.
References B, G, getGOTEntryBlockContent(), Pointer32, and Pointer64.
Referenced by llvm::jitlink::loongarch::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.
Definition at line 304 of file loongarch.h.
References llvm::jitlink::Block::addEdge(), G, getStubBlockContent(), Page20, PageOffset12, and StubEntrySize.
Referenced by llvm::jitlink::loongarch::PLTTableManager::createEntry().
Definition at line 168 of file loongarch.h.
References llvm::Hi, and llvm::Lo.
Referenced by applyFixup().
const char * llvm::jitlink::loongarch::getEdgeKindName | ( | Edge::Kind | K | ) |
Returns a string name for the given loongarch edge.
For debugging purposes only.
Definition at line 36 of file loongarch.cpp.
References Branch26PCRel, Delta32, Delta64, llvm::jitlink::getGenericEdgeKindName(), KIND_NAME_CASE, NegDelta32, Page20, PageOffset12, Pointer32, Pointer64, RequestGOTAndTransformToPage20, and RequestGOTAndTransformToPageOffset12.
Referenced by applyFixup().
Definition at line 261 of file loongarch.h.
References G, and NullPointerContent.
Referenced by createAnonymousPointer().
Definition at line 276 of file loongarch.h.
References G, LA32StubContent, LA64StubContent, and StubEntrySize.
Referenced by createAnonymousPointerJumpStub().
const uint8_t llvm::jitlink::loongarch::LA32StubContent |
Definition at line 30 of file loongarch.cpp.
Referenced by getStubBlockContent().
const uint8_t llvm::jitlink::loongarch::LA64StubContent |
Definition at line 24 of file loongarch.cpp.
Referenced by getStubBlockContent().
loongarch null pointer content.
Definition at line 21 of file loongarch.cpp.
Referenced by getGOTEntryBlockContent().
|
constexpr |
loongarch stub content.
Contains the instruction sequence for an indirect jump via an in-memory pointer: pcalau12i $t8, page20(ptr) ld.[w/d] $t8, pageoff12(ptr) jr $t8
Definition at line 273 of file loongarch.h.
Referenced by createAnonymousPointerJumpStub(), and getStubBlockContent().