1//===-- TPCEHFrameRegistrar.h - TPC based eh-frame registration -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// TargetProcessControl based eh-frame registration.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
14#define LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
15
16#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
17#include "llvm/ExecutionEngine/Orc/TargetProcessControl.h"
18
19namespace llvm {
20namespace orc {
21
22/// Register/Deregisters EH frames in a remote process via a
23/// TargetProcessControl instance.
24class TPCEHFrameRegistrar : public jitlink::EHFrameRegistrar {
25public:
26 /// Create from a TargetProcessControl instance alone. This will use
27 /// the TPC's lookupSymbols method to find the registration/deregistration
28 /// funciton addresses by name.
29 static Expected<std::unique_ptr<TPCEHFrameRegistrar>>
30 Create(TargetProcessControl &TPC);
31
32 /// Create a TPCEHFrameRegistrar with the given TargetProcessControl
33 /// object and registration/deregistration function addresses.
34 TPCEHFrameRegistrar(TargetProcessControl &TPC,
35 JITTargetAddress RegisterEHFrameWrapperFnAddr,
36 JITTargetAddress DeregisterEHFRameWrapperFnAddr)
37 : TPC(TPC), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
38 DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
39
40 Error registerEHFrames(JITTargetAddress EHFrameSectionAddr,
41 size_t EHFrameSectionSize) override;
42 Error deregisterEHFrames(JITTargetAddress EHFrameSectionAddr,
43 size_t EHFrameSectionSize) override;
44
45private:
46 TargetProcessControl &TPC;
47 JITTargetAddress RegisterEHFrameWrapperFnAddr;
48 JITTargetAddress DeregisterEHFrameWrapperFnAddr;
49};
50
51} // end namespace orc
52} // end namespace llvm
53
54#endif // LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
55