LLVM  10.0.0svn
EHFrameSupport.h
Go to the documentation of this file.
1 //===--------- EHFrameSupport.h - JITLink eh-frame utils --------*- 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 // EHFrame registration support for JITLink.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_JITLINK_EHFRAMESUPPORT_H
14 #define LLVM_EXECUTIONENGINE_JITLINK_EHFRAMESUPPORT_H
15 
16 #include "llvm/ADT/Triple.h"
19 #include "llvm/Support/Error.h"
20 
21 namespace llvm {
22 namespace jitlink {
23 
24 /// Registers all FDEs in the given eh-frame section with the current process.
25 Error registerEHFrameSection(const void *EHFrameSectionAddr,
26  size_t EHFrameSectionSize);
27 
28 /// Deregisters all FDEs in the given eh-frame section with the current process.
29 Error deregisterEHFrameSection(const void *EHFrameSectionAddr,
30  size_t EHFrameSectionSize);
31 
32 /// Supports registration/deregistration of EH-frames in a target process.
34 public:
35  virtual ~EHFrameRegistrar();
36  virtual Error registerEHFrames(JITTargetAddress EHFrameSectionAddr,
37  size_t EHFrameSectionSize) = 0;
38  virtual Error deregisterEHFrames(JITTargetAddress EHFrameSectionAddr,
39  size_t EHFrameSectionSize) = 0;
40 };
41 
42 /// Registers / Deregisters EH-frames in the current process.
44 public:
45  /// Get a reference to the InProcessEHFrameRegistrar singleton.
46  static InProcessEHFrameRegistrar &getInstance();
47 
50  operator=(const InProcessEHFrameRegistrar &) = delete;
51 
54 
56  size_t EHFrameSectionSize) override {
58  jitTargetAddressToPointer<void *>(EHFrameSectionAddr),
59  EHFrameSectionSize);
60  }
61 
63  size_t EHFrameSectionSize) override {
65  jitTargetAddressToPointer<void *>(EHFrameSectionAddr),
66  EHFrameSectionSize);
67  }
68 
69 private:
71 };
72 
74  std::function<void(JITTargetAddress EHFrameSectionAddr,
75  size_t EHFrameSectionSize)>;
76 
77 /// Creates a pass that records the address and size of the EH frame section.
78 /// If no eh-frame section is found then the address and size will both be given
79 /// as zero.
80 ///
81 /// Authors of JITLinkContexts can use this function to register a post-fixup
82 /// pass that records the range of the eh-frame section. This range can
83 /// be used after finalization to register and deregister the frame.
86  StoreFrameRangeFunction StoreFrameRange);
87 
88 } // end namespace jitlink
89 } // end namespace llvm
90 
91 #endif // LLVM_EXECUTIONENGINE_JITLINK_EHFRAMESUPPORT_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
uint64_t JITTargetAddress
Represents an address in the target process&#39;s address space.
Definition: JITSymbol.h:41
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
print Print MemDeps of function