ΒΆllvm::Error
addFunctionPointerRelocationsToCurrentSymbol(
    jitlink::Symbol& Sym,
    jitlink::LinkGraph& G,
    llvm::MCDisassembler& Disassembler,
    llvm::MCInstrAnalysis& MIA)

Description

Introduce relocations to \p Sym in its own definition if there are any pointers formed via PC-relative address that do not already have a relocation. This is useful when introducing indirection via a stub function at link time without compiler support. If a function pointer is formed without a relocation, e.g. in the definition of \c foo the pointer to \c _foo computed by \c _foo and \c _bar may differ if we introduce a stub for _foo. If the pointer is used as a key, this may be observable to the program. This pass will attempt to introduce the missing "self-relocation" on the leaq instruction. This is based on disassembly and should be considered "best effort". It may silently fail to add relocations.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h:589

Parameters

jitlink::Symbol& Sym
jitlink::LinkGraph& G
llvm::MCDisassembler& Disassembler
llvm::MCInstrAnalysis& MIA