[PATCH] D126492: [ORC][ORC_RT] Integrate ORC platforms with LLJIT and lli

Peter S. Housel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 12:02:44 PDT 2022


housel created this revision.
housel added a reviewer: lhames.
Herald added subscribers: StephenFan, hiraditya, mgorny, emaste.
Herald added a project: All.
housel requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

This patch enables integrating `orc::LLJIT` with the ORCv2 platforms (`MachOPlatform` and `ELFNixPlatform`) and the compiler-rt orc runtime. Changes include:

- Adding SPS wrapper functions for the orc runtime's `dlfcn` emulation functions, allowing initialization and deinitialization to be invoked by `LLJIT`
- Changing the LLJIT code generation default to add `UseInitArray` so that `.init_array` constructors are generated for ELF platforms
- Integrating the ORCv2 Platforms into `lli`, and adding a `PlatformSupport` implementation to the `LLJIT` instance used by `lli` which implements initialization and deinitialization by calling the new wrapper functions in the runtime.

Open issues:

- Should the `ORCPlatformSupport` class included in `lli` be moved into `LLJIT`?
- The integration test for Darwin explicitly sets `-relocation-model=pic` when invoking `lli` so that a `__DATA,__mod_init_func` section is generated; if this is not done the default code generation options use the static relocation mode, which causes a `__TEXT, __constructor` to be generated, and the runtime does not deal with these. Might there be a better way to handle this?
- ehframe registration support probably works but there isn't an integration test for it yet


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126492

Files:
  compiler-rt/lib/orc/CMakeLists.txt
  compiler-rt/lib/orc/dlfcn_wrapper.cpp
  compiler-rt/test/orc/TestCases/Darwin/x86-64/lljit-initialize-deinitialize.ll
  compiler-rt/test/orc/TestCases/FreeBSD/x86-64/lljit-initialize-deinitialize.ll
  compiler-rt/test/orc/TestCases/Linux/x86-64/lljit-initialize-deinitialize.ll
  compiler-rt/test/orc/lit.cfg.py
  llvm/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h
  llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
  llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
  llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
  llvm/tools/lli/lli.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126492.432330.patch
Type: text/x-patch
Size: 19238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220526/8d9d72e3/attachment.bin>


More information about the llvm-commits mailing list