Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:54

0001 //===- UnwindInfoRegistrationPlugin.h -- libunwind registration -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Register eh-frame and compact-unwind sections with libunwind
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H
0014 #define LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H
0015 
0016 #include "llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h"
0017 
0018 namespace llvm::orc {
0019 
0020 class UnwindInfoRegistrationPlugin : public LinkGraphLinkingLayer::Plugin {
0021 public:
0022   UnwindInfoRegistrationPlugin(ExecutionSession &ES, ExecutorAddr Register,
0023                                ExecutorAddr Deregister)
0024       : ES(ES), Register(Register), Deregister(Deregister) {
0025     DSOBaseName = ES.intern("__jitlink$libunwind_dso_base");
0026   }
0027 
0028   static Expected<std::shared_ptr<UnwindInfoRegistrationPlugin>>
0029   Create(ExecutionSession &ES, ExecutorAddr Register, ExecutorAddr Deregister);
0030 
0031   static Expected<std::shared_ptr<UnwindInfoRegistrationPlugin>>
0032   Create(ExecutionSession &ES);
0033 
0034   void modifyPassConfig(MaterializationResponsibility &MR,
0035                         jitlink::LinkGraph &G,
0036                         jitlink::PassConfiguration &PassConfig) override;
0037 
0038   Error notifyEmitted(MaterializationResponsibility &MR) override {
0039     return Error::success();
0040   }
0041 
0042   Error notifyFailed(MaterializationResponsibility &MR) override {
0043     return Error::success();
0044   }
0045 
0046   Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override {
0047     return Error::success();
0048   }
0049 
0050   void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey,
0051                                    ResourceKey SrcKey) override {}
0052 
0053 private:
0054   Error addUnwindInfoRegistrationActions(jitlink::LinkGraph &G);
0055 
0056   ExecutionSession &ES;
0057   SymbolStringPtr DSOBaseName;
0058   ExecutorAddr Register, Deregister;
0059 };
0060 
0061 } // namespace llvm::orc
0062 
0063 #endif // LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H