EPCEHFrameRegistrar.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. static Expected<std::unique_ptr<EPCEHFrameRegistrar>>
  32. Create(ExecutionSession &ES);
  33. /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
  34. /// object and registration/deregistration function addresses.
  35. EPCEHFrameRegistrar(ExecutionSession &ES,
  36. ExecutorAddr RegisterEHFrameWrapperFnAddr,
  37. ExecutorAddr DeregisterEHFRameWrapperFnAddr)
  38. : ES(ES), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
  39. DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
  40. Error registerEHFrames(ExecutorAddrRange EHFrameSection) override;
  41. Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override;
  42. private:
  43. ExecutionSession &ES;
  44. ExecutorAddr RegisterEHFrameWrapperFnAddr;
  45. ExecutorAddr DeregisterEHFrameWrapperFnAddr;
  46. };
  47. } // end namespace orc
  48. } // end namespace llvm
  49. #endif // LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  50. #ifdef __GNUC__
  51. #pragma GCC diagnostic pop
  52. #endif