1 //===-- EPCEHFrameRegistrar.h - EPC 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 // ExecutorProcessControl based eh-frame registration. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H 14 #define LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H 15 16 #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h" 17 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" 18 19 namespace llvm { 20 namespace orc { 21 22 class ExecutionSession; 23 24 /// Register/Deregisters EH frames in a remote process via a 25 /// ExecutorProcessControl instance. 26 class EPCEHFrameRegistrar : public jitlink::EHFrameRegistrar { 27 public: 28 /// Create from a ExecutorProcessControl instance alone. This will use 29 /// the EPC's lookupSymbols method to find the registration/deregistration 30 /// function addresses by name. 31 /// 32 /// If RegistrationFunctionsDylib is non-None then it will be searched to 33 /// find the registration functions. If it is None then the process dylib 34 /// will be loaded to find the registration functions. 35 static Expected<std::unique_ptr<EPCEHFrameRegistrar>> 36 Create(ExecutionSession &ES); 37 38 /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl 39 /// object and registration/deregistration function addresses. 40 EPCEHFrameRegistrar(ExecutionSession &ES, 41 ExecutorAddr RegisterEHFrameSectionWrapper, 42 ExecutorAddr DeregisterEHFRameSectionWrapper) 43 : ES(ES), RegisterEHFrameSectionWrapper(RegisterEHFrameSectionWrapper), 44 DeregisterEHFrameSectionWrapper(DeregisterEHFRameSectionWrapper) {} 45 46 Error registerEHFrames(ExecutorAddrRange EHFrameSection) override; 47 Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override; 48 49 private: 50 ExecutionSession &ES; 51 ExecutorAddr RegisterEHFrameSectionWrapper; 52 ExecutorAddr DeregisterEHFrameSectionWrapper; 53 }; 54 55 } // end namespace orc 56 } // end namespace llvm 57 58 #endif // LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H 59