EPCEHFrameRegistrar.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- EPCEHFrameRegistrar.h - EPC based eh-frame registration -*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // ExecutorProcessControl based eh-frame registration.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  18. #define LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  19. #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
  20. #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
  21. namespace llvm {
  22. namespace orc {
  23. class ExecutionSession;
  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. /// funciton 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. std::optional<ExecutorAddr> RegistrationFunctionsDylib = std::nullopt);
  38. /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
  39. /// object and registration/deregistration function addresses.
  40. EPCEHFrameRegistrar(ExecutionSession &ES,
  41. ExecutorAddr RegisterEHFrameWrapperFnAddr,
  42. ExecutorAddr DeregisterEHFRameWrapperFnAddr)
  43. : ES(ES), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
  44. DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
  45. Error registerEHFrames(ExecutorAddrRange EHFrameSection) override;
  46. Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override;
  47. private:
  48. ExecutionSession &ES;
  49. ExecutorAddr RegisterEHFrameWrapperFnAddr;
  50. ExecutorAddr DeregisterEHFrameWrapperFnAddr;
  51. };
  52. } // end namespace orc
  53. } // end namespace llvm
  54. #endif // LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  55. #ifdef __GNUC__
  56. #pragma GCC diagnostic pop
  57. #endif