Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
35268 views
1
//===------ EPCEHFrameRegistrar.cpp - EPC-based eh-frame registration -----===//
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
#include "llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h"
10
11
#include "llvm/ExecutionEngine/Orc/Core.h"
12
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
13
14
using namespace llvm::orc::shared;
15
16
namespace llvm {
17
namespace orc {
18
19
Expected<std::unique_ptr<EPCEHFrameRegistrar>>
20
EPCEHFrameRegistrar::Create(ExecutionSession &ES) {
21
22
// Lookup addresseses of the registration/deregistration functions in the
23
// bootstrap map.
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);
32
33
return std::make_unique<EPCEHFrameRegistrar>(
34
ES, RegisterEHFrameSectionWrapper, DeregisterEHFrameSectionWrapper);
35
}
36
37
Error EPCEHFrameRegistrar::registerEHFrames(ExecutorAddrRange EHFrameSection) {
38
return ES.callSPSWrapper<void(SPSExecutorAddrRange)>(
39
RegisterEHFrameSectionWrapper, EHFrameSection);
40
}
41
42
Error EPCEHFrameRegistrar::deregisterEHFrames(
43
ExecutorAddrRange EHFrameSection) {
44
return ES.callSPSWrapper<void(SPSExecutorAddrRange)>(
45
DeregisterEHFrameSectionWrapper, EHFrameSection);
46
}
47
48
} // end namespace orc
49
} // end namespace llvm
50
51