aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2021-11-02 10:49:08 -0700
committerBen Langmuir <blangmuir@apple.com>2021-11-04 15:01:05 -0700
commita2639dcbe613bb2e219a50171f322d7ac1dc8de1 (patch)
tree57a86c7d51d6950a7eee3d32e3870d3eb21ebea2 /llvm/lib/IR/Module.cpp
parent41481b7db5c7b535060b3d36685eb5bb87d1c7d6 (diff)
downloadllvm-a2639dcbe613bb2e219a50171f322d7ac1dc8de1.zip
llvm-a2639dcbe613bb2e219a50171f322d7ac1dc8de1.tar.gz
llvm-a2639dcbe613bb2e219a50171f322d7ac1dc8de1.tar.bz2
[ORC] Add a utility for adding missing "self" relocations to a Symbol
If a tool wants to introduce new indirections via stubs at link-time in ORC, it can cause fidelity issues around the address of the function if some references to the function do not have relocations. This is known to happen inside the body of the function itself on x86_64 for example, where a PC-relative address is formed, but without a relocation. ``` _foo: leaq -7(%rip), %rax ## form pointer to '_foo' without relocation _bar: leaq (%rip), %rax ## uses X86_64_RELOC_SIGNED to '_foo' ``` The consequence of introducing a stub for such a function at link time is that if it forms a pointer to itself without relocation, it will not have the same value as a pointer from outside the function. If the function pointer is used as a key, this can cause problems. This utility provides best-effort support for adding such missing relocations using MCDisassembler and MCInstrAnalysis to identify the problematic instructions. Currently it is only implemented for x86_64. Note: the related issue with call/jump instructions is not handled here, only forming function pointers. rdar://83514317 Differential revision: https://reviews.llvm.org/D113038
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions