1 //===------ EPCEHFrameRegistrar.cpp - EPC-based eh-frame registration -----===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h"
11 #include "llvm/ExecutionEngine/Orc/Core.h"
12 #include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
14 using namespace llvm::orc::shared
;
19 Expected
<std::unique_ptr
<EPCEHFrameRegistrar
>>
20 EPCEHFrameRegistrar::Create(ExecutionSession
&ES
) {
22 // Lookup addresseses of the registration/deregistration functions in the
24 ExecutorAddr RegisterEHFrameSectionWrapper
;
25 ExecutorAddr DeregisterEHFrameSectionWrapper
;
26 if (auto Err
= ES
.getExecutorProcessControl().getBootstrapSymbols(
27 {{RegisterEHFrameSectionWrapper
,
28 rt::RegisterEHFrameSectionWrapperName
},
29 {DeregisterEHFrameSectionWrapper
,
30 rt::DeregisterEHFrameSectionWrapperName
}}))
31 return std::move(Err
);
33 return std::make_unique
<EPCEHFrameRegistrar
>(
34 ES
, RegisterEHFrameSectionWrapper
, DeregisterEHFrameSectionWrapper
);
37 Error
EPCEHFrameRegistrar::registerEHFrames(ExecutorAddrRange EHFrameSection
) {
38 return ES
.callSPSWrapper
<void(SPSExecutorAddrRange
)>(
39 RegisterEHFrameSectionWrapper
, EHFrameSection
);
42 Error
EPCEHFrameRegistrar::deregisterEHFrames(
43 ExecutorAddrRange EHFrameSection
) {
44 return ES
.callSPSWrapper
<void(SPSExecutorAddrRange
)>(
45 DeregisterEHFrameSectionWrapper
, EHFrameSection
);
48 } // end namespace orc
49 } // end namespace llvm