TPCEHFrameRegistrar.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- TPCEHFrameRegistrar.h - TPC 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. // TargetProcessControl based eh-frame registration.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
  18. #define LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
  19. #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
  20. #include "llvm/ExecutionEngine/Orc/TargetProcessControl.h"
  21. namespace llvm {
  22. namespace orc {
  23. /// Register/Deregisters EH frames in a remote process via a
  24. /// TargetProcessControl instance.
  25. class TPCEHFrameRegistrar : public jitlink::EHFrameRegistrar {
  26. public:
  27. /// Create from a TargetProcessControl instance alone. This will use
  28. /// the TPC's lookupSymbols method to find the registration/deregistration
  29. /// funciton addresses by name.
  30. static Expected<std::unique_ptr<TPCEHFrameRegistrar>>
  31. Create(TargetProcessControl &TPC);
  32. /// Create a TPCEHFrameRegistrar with the given TargetProcessControl
  33. /// object and registration/deregistration function addresses.
  34. TPCEHFrameRegistrar(TargetProcessControl &TPC,
  35. JITTargetAddress RegisterEHFrameWrapperFnAddr,
  36. JITTargetAddress DeregisterEHFRameWrapperFnAddr)
  37. : TPC(TPC), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
  38. DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
  39. Error registerEHFrames(JITTargetAddress EHFrameSectionAddr,
  40. size_t EHFrameSectionSize) override;
  41. Error deregisterEHFrames(JITTargetAddress EHFrameSectionAddr,
  42. size_t EHFrameSectionSize) override;
  43. private:
  44. TargetProcessControl &TPC;
  45. JITTargetAddress RegisterEHFrameWrapperFnAddr;
  46. JITTargetAddress DeregisterEHFrameWrapperFnAddr;
  47. };
  48. } // end namespace orc
  49. } // end namespace llvm
  50. #endif // LLVM_EXECUTIONENGINE_ORC_TPCEHFRAMEREGISTRAR_H
  51. #ifdef __GNUC__
  52. #pragma GCC diagnostic pop
  53. #endif