summaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
AgeCommit message (Collapse)Author
2025-06-27[ORC] Add read operations to orc::MemoryAccess. (#145834)Lang Hames
This commit adds operations to orc::MemoryAccess for reading basic types (uint8_t, uint16_t, uint32_t, uint64_t, pointers, buffers, and strings) from executor memory. The InProcessMemoryAccess and EPCGenericMemoryAccess implementations are updated to support the new operations.
2025-02-07[ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT.Lang Hames
The system libunwind on older Darwins does not support JIT registration of compact-unwind. Since the CompactUnwindManager utility discards redundant eh-frame FDEs by default we need to remove the compact-unwind section first when targeting older libunwinds in order to preserve eh-frames. While LLJIT was already doing this as of eae6d6d18bd, MachOPlatform was not. This was causing buildbot failures in the ORC runtime (e.g. in https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3479/). This patch updates both LLJIT and MachOPlatform to check a bootstrap value, "darwin-use-ehframes-only", to determine whether to forcibly preserve eh-frame sections. If this value is present and set to true then compact-unwind sections will be discarded, causing eh-frames to be preserved. If the value is absent or set to false then compact-unwind will be used and redundant FDEs in eh-frames discarded (FDEs that are needed by the compact-unwind section are always preserved). rdar://143895614
2024-12-06[ORC] Provide default MemoryAccess in SimpleRemoteEPC, add WritePointers impl.Lang Hames
Make EPCGenericMemoryAccess the default implementation for the MemoryAccess object in SimpleRemoteEPC, and add support for the WritePointers operation to OrcTargetProcess (previously this operation was unimplemented and would have triggered an error if accessed in a remote-JIT setup). No testcase yet: This functionality requires cross-process JITing to test (or a much more elaborate unit-test setup). It can be tested once the new top-level ORC runtime project lands.
2022-08-11[ORC][COFF] Introduce COFFVCRuntimeBootstrapper.Sunho Kim
Introduces COFFVCRuntimeBootstrapper that loads/initialize vc runtime libraries. In COFF, we *must* jit-link vc runtime libraries as COFF relocation types have no proper way to deal with out-of-reach data symbols ragardless of linking mode. (even dynamic version msvcrt.lib have tons of static data symbols that must be jit-linked) This class tries to load vc runtime library files from msvc installations with an option to override the path. There are some complications when dealing with static version of vc runtimes. First, they need static initializers to be ran that requires COFFPlatform support but orc runtime will not be usable before vc runtimes are fully initialized. (as orc runtime will use msvc stl libraries) COFFPlatform that will be introduced in a following up patch will collect static initializers and run them manually in host before boostrapping itself. So, the user will have to do the following. 1. Create COFFPlatform that addes static initializer collecting passes. 2. LoadVCRuntime 3. InitializeVCRuntime 4. COFFPlatform.bootstrap() Second, the internal crt initialization function had to be reimplemented in orc side. There are other ways of doing this, but this is the simplest implementation that makes platform fully responsible for static initializer. The complication comes from the fact that crt initialization functions (such as acrt_initialize or dllmain_crt_process_attach) actually run all static initializers by traversing from `__xi_a` symbol to `__xi_z`. This requires symbols to be contiguously allocated in sections alphabetically sorted in memory, which is not possible right now and not practical in jit setting. We might ignore emission of `__xi_a` and `__xi_z` symbol and allocate them ourselves, but we have to take extra care after orc runtime boostrap has been done -- as that point orc runtime should be the one running the static initializers. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D130456
2022-01-08[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.Lang Hames
These types performed identical roles. Merging them simplifies interoperability between JITLink and ORC APIs (allowing us to address a few FIXMEs).
2021-10-30[ORC] Move CWrapperFunctionResult out of the detail:: namespace.Lang Hames
This type has been moved up into the llvm::orc::shared namespace. This type was originally put in the detail:: namespace on the assumption that few (if any) LLVM source files would need to use it. In practice it has been needed in many places, and will continue to be needed until/unless OrcTargetProcess is fully merged into the ORC runtime.
2021-10-28Reapply e32b1eee6aa "[ORC] Change SPSExecutorAddr serialization,..." with fixes.Lang Hames
This re-applies e32b1eee6aab52e2b7b75ee15e506b3e7dd30e68, which was reverted in 20675d8f7dab293172266fdde426c2173b5b3997 due to broken unit tests. This patch includes fixes for the tests.
2021-10-27Revert "[ORC] Change SPSExecutorAddr serialization, SupportFunctionCall struct."Lang Hames
This reverts commit e32b1eee6aab52e2b7b75ee15e506b3e7dd30e68. Reverting while I fix some broken unit tests.
2021-10-27[ORC] Change SPSExecutorAddr serialization, SupportFunctionCall struct.Lang Hames
SPSExecutorAddr will now be serializable to/from ExecutorAddr, rather than uint64_t. This improves type safety when working with serialized addresses. Also updates the SupportFunctionCall to use an ExecutorAddrRange (rather than a separate ExecutorAddr addr and uint64_t size field), and updates the tpctypes::*Write data structures to use ExecutorAddr rather than JITTargetAddress.
2021-09-27Reintroduce "[ORC] Introduce EPCGenericRTDyldMemoryManager."Lang Hames
This reintroduces "[ORC] Introduce EPCGenericRTDyldMemoryManager." (bef55a2b47a938ef35cbd7b61a1e5fa74e68c9ed) and "[lli] Add ChildTarget dependence on OrcTargetProcess library." (7a219d801bf2c3006482cf3cbd3170b3b4ea2e1b) which were reverted in 99951a56842d8e4cd0706cd17a04f77b5d0f6dd0 due to bot failures. The root cause of the bot failures should be fixed by "[ORC] Fix uninitialized variable." (0371049277912afc201da721fa659ecef7ab7fba) and "[ORC] Wait for handleDisconnect to complete in SimpleRemoteEPC::disconnect." (320832cc9b7e7fea5fc8afbed75c34c4a43287ba).
2021-09-25Revert "[ORC] Introduce EPCGenericRTDyldMemoryManager."Lang Hames
This reverts commit bef55a2b47a938ef35cbd7b61a1e5fa74e68c9ed while I investigate failures on some bots. Also reverts "[lli] Add ChildTarget dependence on OrcTargetProcess library." (7a219d801bf2c3006482cf3cbd3170b3b4ea2e1b) which was a fallow-up to bef55a2b47a.
2021-09-25[ORC] Introduce EPCGenericRTDyldMemoryManager.Lang Hames
EPCGenericRTDyldMemoryMnaager is an EPC-based implementation of the RuntimeDyld::MemoryManager interface. It enables remote-JITing via EPC (backed by a SimpleExecutorMemoryManager instance on the executor side) for RuntimeDyld clients. The lli and lli-child-target tools are updated to use SimpleRemoteEPC and SimpleRemoteEPCServer (rather than OrcRemoteTargetClient/Server), and EPCGenericRTDyldMemoryManager for MCJIT tests. By enabling remote-JITing for MCJIT and RuntimeDyld-based ORC clients, EPCGenericRTDyldMemoryManager allows us to deprecate older remote-JITing support, including OrcTargetClient/Server, OrcRPCExecutorProcessControl, and the Orc RPC system itself. These will be removed in future patches.
2021-09-23[ORC] Rename ExecutorAddress to ExecutorAddr.Lang Hames
Removing the 'ess' suffix improves the ergonomics without sacrificing clarity. Since this class is likely to be used more frequently in the future it's worth some short term pain to fix this now.
2021-09-17[ORC] Add finalization & deallocation actions, SimpleExecutorMemoryManager classLang Hames
Finalization and deallocation actions are a key part of the upcoming JITLinkMemoryManager redesign: They generalize the existing finalization and deallocate concepts (basically "copy-and-mprotect", and "munmap") to include support for arbitrary registration and deregistration of parts of JIT linked code. This allows us to register and deregister eh-frames, TLV sections, language metadata, etc. using regular memory management calls with no additional IPC/RPC overhead, which should both improve JIT performance and simplify interactions between ORC and the ORC runtime. The SimpleExecutorMemoryManager class provides executor-side support for memory management operations, including finalization and deallocation actions. This support is being added in advance of the rest of the memory manager redesign as it will simplify the introduction of an EPC based RuntimeDyld::MemoryManager (since eh-frame registration/deregistration will be expressible as actions). The new RuntimeDyld::MemoryManager will in turn allow us to remove older remote allocators that are blocking the rest of the memory manager changes.
2021-09-14[ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.Lang Hames
This is a small first step towards reorganization of the ORC libraries: Declarations for types and function names (as strings) to be found in the "ORC runtime bootstrap" set are moved into OrcRTBridge.h / OrcRTBridge.cpp. The current implementation of the "ORC runtime bootstrap" functions is moved into OrcRTBootstrap.h and OrcRTBootstrap.cpp. It is likely that this code will eventually be moved into ORT-RT proper (in compiler RT). The immediate goal of this change is to make these bootstrap functions usable for clients other than SimpleRemoteEPC/SimpleRemoteEPCServer. The first planned client is a new RuntimeDyld::MemoryManager that will run over EPC, which will allow us to remove the old OrcRemoteTarget code.