Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===-- EPCEHFrameRegistrar.h - EPC based eh-frame registration -*- 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. // ExecutorProcessControl based eh-frame registration.
  10. //
  11. //===----------------------------------------------------------------------===//
  12.  
  13. #ifndef LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  14. #define LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  15.  
  16. #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
  17. #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
  18.  
  19. namespace llvm {
  20. namespace orc {
  21.  
  22. class ExecutionSession;
  23.  
  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.  
  39.   /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
  40.   /// object and registration/deregistration function addresses.
  41.   EPCEHFrameRegistrar(ExecutionSession &ES,
  42.                       ExecutorAddr RegisterEHFrameWrapperFnAddr,
  43.                       ExecutorAddr DeregisterEHFRameWrapperFnAddr)
  44.       : ES(ES), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
  45.         DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
  46.  
  47.   Error registerEHFrames(ExecutorAddrRange EHFrameSection) override;
  48.   Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override;
  49.  
  50. private:
  51.   ExecutionSession &ES;
  52.   ExecutorAddr RegisterEHFrameWrapperFnAddr;
  53.   ExecutorAddr DeregisterEHFrameWrapperFnAddr;
  54. };
  55.  
  56. } // end namespace orc
  57. } // end namespace llvm
  58.  
  59. #endif // LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
  60.