llvm-project/llvm/lib/ExecutionEngine
Ben Langmuir a2639dcbe6 [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
2021-11-04 15:01:05 -07:00
..
IntelJITEvents New tag for ittapi - fix an error related to cross-compiling ITTAPI in LLVM with mingw 2021-05-14 08:18:49 +03:00
Interpreter Use llvm_unreachable for unsupported integer types. 2021-06-08 17:59:05 +01:00
JITLink [JITLink] Fix alloc action call signature in InProcessMemoryManager. 2021-10-31 10:27:40 -07:00
MCJIT [llvm] Update report_fatal_error calls from raw_string_ostream to use Twine(OS.str()) 2021-10-05 18:42:12 +01:00
OProfileJIT llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Orc [ORC] Add a utility for adding missing "self" relocations to a Symbol 2021-11-04 15:01:05 -07:00
PerfJITEvents [perf] Fix a data race in the PerfJITEventListener 2021-06-29 08:30:31 -07:00
RuntimeDyld [ExecutionEngine] remove unused <string> includes 2021-10-07 12:07:15 +01:00
CMakeLists.txt [lli] Add JITLink in-process debug support 2021-03-02 15:07:36 +01:00
ExecutionEngine.cpp Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
ExecutionEngineBindings.cpp [NFC] Cleanup more AttributeList::addAttribute() 2021-08-17 21:05:41 -07:00
GDBRegistrationListener.cpp [lli] Add JITLink in-process debug support 2021-03-02 15:07:36 +01:00
SectionMemoryManager.cpp Revert "[examples] Fix SectionMemoryManager deconstruction error with MSVC." 2021-09-17 17:42:25 +10:00
TargetSelect.cpp Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00