LLVM 17.0.0git
Classes | Enumerations | Functions | Variables
llvm::jitlink::aarch64 Namespace Reference

Classes

class  GOTTableManager
 Global Offset Table Builder. More...
 
class  PLTTableManager
 Procedure Linkage Table Builder. More...
 

Enumerations

enum  EdgeKind_aarch64 : Edge::Kind {
  Pointer64 = Edge::FirstRelocation , Pointer32 , Delta64 , Delta32 ,
  NegDelta64 , NegDelta32 , Branch26PCRel , MoveWide16 ,
  LDRLiteral19 , Page21 , PageOffset12 , RequestGOTAndTransformToPage21 ,
  RequestGOTAndTransformToPageOffset12 , RequestGOTAndTransformToDelta32 , RequestTLVPAndTransformToPage21 , RequestTLVPAndTransformToPageOffset12 ,
  RequestTLSDescEntryAndTransformToPage21 , RequestTLSDescEntryAndTransformToPageOffset12
}
 Represents aarch64 fixups and other aarch64-specific edge kinds. More...
 

Functions

const chargetEdgeKindName (Edge::Kind K)
 Returns a string name for the given aarch64 edge.
 
bool isLoadStoreImm12 (uint32_t Instr)
 
unsigned getPageOffset12Shift (uint32_t Instr)
 
bool isMoveWideImm16 (uint32_t Instr)
 
unsigned getMoveWide16Shift (uint32_t Instr)
 
Error applyFixup (LinkGraph &G, Block &B, const Edge &E)
 Apply fixup expression for edge to block content.
 
SymbolcreateAnonymousPointer (LinkGraph &G, Section &PointerSection, Symbol *InitialTarget=nullptr, uint64_t InitialAddend=0)
 Creates a new pointer block in the given section and returns an Anonymous symobl pointing to it.
 
BlockcreatePointerJumpStubBlock (LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)
 Create a jump stub block that jumps via the pointer at the given symbol.
 
SymbolcreateAnonymousPointerJumpStub (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

constexpr uint64_t PointerSize = 8
 aarch64 pointer size.
 
const char NullPointerContent [PointerSize]
 AArch64 null pointer content.
 
const char PointerJumpStubContent [12]
 

Enumeration Type Documentation

◆ EdgeKind_aarch64

Represents aarch64 fixups and other aarch64-specific edge kinds.

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:

  • The target must reside in the low 32-bits of the address space, otherwise an out-of-range error will be returned.
Delta64 

A 64-bit delta.

Delta from the fixup to the target.

Fixup expression: Fixup <- Target - Fixup + Addend : int64

Delta32 

A 32-bit delta.

Delta from the fixup to the target.

Fixup expression: Fixup <- Target - Fixup + Addend : int64

Errors:

  • The result of the fixup expression must fit into an int32, otherwise an out-of-range error will be returned.
NegDelta64 

A 64-bit negative delta.

Delta from target back to the fixup.

Fixup expression: Fixup <- Fixup - Target + Addend : int64

NegDelta32 

A 32-bit negative delta.

Delta from the target back to the fixup.

Fixup expression: Fixup <- Fixup - Target + Addend : int32

Errors:

  • The result of the fixup expression must fit into an int32, otherwise an out-of-range error will be returned.
Branch26PCRel 

A 26-bit PC-relative branch.

Represents a PC-relative call or branch to a target within +/-128Mb. The target must be 32-bit 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 and MachO relocations. Since the low two bits must be zero (because of the 32-bit alignment of the target) the operand is effectively a signed 28-bit number.

Errors:

  • The result of the unshifted part of the fixup expression must be 32-bit aligned otherwise an alignment error will be returned.
  • The result of the fixup expression must fit into an int26 otherwise an out-of-range error will be returned.
MoveWide16 

A 16-bit slice of the target address (which slice depends on the instruction at the fixup location).

Used to fix up MOVK/MOVN/MOVZ instructions.

Fixup expression:

Fixup <- (Target + Addend) >> Shift : uint16

where Shift is encoded in the instruction at the fixup location.

LDRLiteral19 

The signed 21-bit delta from the fixup to the target.

Typically used to load a pointers at a PC-relative offset of +/- 1Mb. The target must be 32-bit aligned.

Fixup expression:

Fixup <- (Target - Fixup) >> 2 : int19

Errors:

  • The result of the unshifted part of the fixup expression must be 32-bit aligned otherwise an alignment error will be returned.
  • The result of the fixup expression must fit into an an int19 or an out-of-range error will be returned.
Page21 

The signed 21-bit delta from the fixup page to the page containing the target.

Fixup expression:

Fixup <- (((Target + Addend) & ~0xfff) - (Fixup & ~0xfff)) >> 12 : int21

Notes: For ADRP fixups.

Errors:

  • The result of the fixup expression must fit into an int21 otherwise an out-of-range error will be returned.
PageOffset12 

The 12-bit (potentially shifted) offset of the target within its page.

Typically used to fix up LDR immediates.

Fixup expression:

Fixup <- ((Target + Addend) >> Shift) & 0xfff : uint12

where Shift is encoded in the size field of the instruction.

Errors:

  • The result of the unshifted part of the fixup expression must be aligned otherwise an alignment error will be returned.
  • The result of the fixup expression must fit into a uint12 otherwise an out-of-range error will be returned.
RequestGOTAndTransformToPage21 

A GOT entry getter/constructor, transformed to Page21 pointing at the GOT entry for the original target.

Indicates that this edge should be transformed into a Page21 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:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
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 builder pass inserted by default.

Fixup expression: NONE

Errors:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
RequestGOTAndTransformToDelta32 

A GOT entry getter/constructor, transformed to Delta32 pointing at the GOT entry for the original target.

Indicates that this edge should be transformed into a Delta32/ 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:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
RequestTLVPAndTransformToPage21 

A TLVP entry getter/constructor, transformed to Page21.

Indicates that this edge should be transformed into a Page21 targeting the TLVP entry for the edge's current target. A TLVP entry for the target should be created if one does not already exist.

Fixup expression: NONE

Errors:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
RequestTLVPAndTransformToPageOffset12 

A TLVP entry getter/constructor, transformed to PageOffset12.

Indicates that this edge should be transformed into a PageOffset12 targeting the TLVP entry for the edge's current target. A TLVP entry for the target should be created if one does not already exist.

Fixup expression: NONE

Errors:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
RequestTLSDescEntryAndTransformToPage21 

A TLSDesc entry getter/constructor, transformed to Page21.

Indicates that this edge should be transformed into a Page21 targeting the TLSDesc entry for the edge's current target. A TLSDesc entry for the target should be created if one does not already exist.

Fixup expression: NONE

Errors:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.
RequestTLSDescEntryAndTransformToPageOffset12 

A TLSDesc entry getter/constructor, transformed to PageOffset12.

Indicates that this edge should be transformed into a PageOffset12 targeting the TLSDesc entry for the edge's current target. A TLSDesc entry for the target should be created if one does not already exist.

Fixup expression: NONE

Errors:

  • ASSERTION Failure to handle edges of this kind prior to the fixup phase will result in an assert/unreachable during the fixup phase.

Definition at line 25 of file aarch64.h.

Function Documentation

◆ applyFixup()

Error llvm::jitlink::aarch64::applyFixup ( LinkGraph G,
Block B,
const Edge E 
)
inline

◆ createAnonymousPointer()

Symbol & llvm::jitlink::aarch64::createAnonymousPointer ( LinkGraph G,
Section PointerSection,
Symbol InitialTarget = nullptr,
uint64_t  InitialAddend = 0 
)
inline

Creates a new pointer block in the given section and returns an Anonymous symobl 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: 64-bit alignment-offset: 0 address: highest allowable (~7U)

Definition at line 503 of file aarch64.h.

References B, G, NullPointerContent, and Pointer64.

Referenced by llvm::jitlink::aarch64::GOTTableManager::createEntry().

◆ createAnonymousPointerJumpStub()

Symbol & llvm::jitlink::aarch64::createAnonymousPointerJumpStub ( LinkGraph G,
Section StubSection,
Symbol PointerSymbol 
)
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 532 of file aarch64.h.

References createPointerJumpStubBlock(), G, and PointerJumpStubContent.

Referenced by llvm::jitlink::aarch64::PLTTableManager::createEntry().

◆ createPointerJumpStubBlock()

Block & llvm::jitlink::aarch64::createPointerJumpStubBlock ( LinkGraph G,
Section StubSection,
Symbol PointerSymbol 
)
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: 32-bit alignment-offset: 0 address: highest allowable: (~11U)

Definition at line 519 of file aarch64.h.

References B, G, Page21, PageOffset12, and PointerJumpStubContent.

Referenced by createAnonymousPointerJumpStub().

◆ getEdgeKindName()

const char * llvm::jitlink::aarch64::getEdgeKindName ( Edge::Kind  K)

◆ getMoveWide16Shift()

unsigned llvm::jitlink::aarch64::getMoveWide16Shift ( uint32_t  Instr)
inline

Definition at line 333 of file aarch64.h.

References isMoveWideImm16().

Referenced by applyFixup().

◆ getPageOffset12Shift()

unsigned llvm::jitlink::aarch64::getPageOffset12Shift ( uint32_t  Instr)
inline

Definition at line 308 of file aarch64.h.

References isLoadStoreImm12().

Referenced by applyFixup().

◆ isLoadStoreImm12()

bool llvm::jitlink::aarch64::isLoadStoreImm12 ( uint32_t  Instr)
inline

Definition at line 297 of file aarch64.h.

Referenced by getPageOffset12Shift().

◆ isMoveWideImm16()

bool llvm::jitlink::aarch64::isMoveWideImm16 ( uint32_t  Instr)
inline

Definition at line 324 of file aarch64.h.

Referenced by applyFixup(), and getMoveWide16Shift().

Variable Documentation

◆ NullPointerContent

const char llvm::jitlink::aarch64::NullPointerContent
Initial value:
= {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}

AArch64 null pointer content.

Definition at line 21 of file aarch64.cpp.

Referenced by createAnonymousPointer().

◆ PointerJumpStubContent

const char llvm::jitlink::aarch64::PointerJumpStubContent
Initial value:
= {
0x10, 0x00, 0x00, (char)0x90u,
0x10, 0x02, 0x40, (char)0xf9u,
0x00, 0x02, 0x1f, (char)0xd6u
}

Definition at line 24 of file aarch64.cpp.

Referenced by createAnonymousPointerJumpStub(), and createPointerJumpStubBlock().

◆ PointerSize

constexpr uint64_t llvm::jitlink::aarch64::PointerSize = 8
constexpr

aarch64 pointer size.

Definition at line 479 of file aarch64.h.