1//===- EPCGenericDylibManager.h -- Generic EPC Dylib management -*- 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// Implements dylib loading and searching by making calls to 10// ExecutorProcessControl::callWrapper. 11// 12// This simplifies the implementaton of new ExecutorProcessControl instances, 13// as this implementation will always work (at the cost of some performance 14// overhead for the calls). 15// 16//===----------------------------------------------------------------------===// 17 18#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H 19#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H 20 21#include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h" 22#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h" 23#include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h" 24 25namespace llvm { 26namespace orc { 27 28class SymbolLookupSet; 29 30class EPCGenericDylibManager { 31public: 32 /// Function addresses for memory access. 33 struct SymbolAddrs { 34 ExecutorAddr Instance; 35 ExecutorAddr Open; 36 ExecutorAddr Lookup; 37 }; 38 39 /// Create an EPCGenericMemoryAccess instance from a given set of 40 /// function addrs. 41 static Expected<EPCGenericDylibManager> 42 CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC); 43 44 /// Create an EPCGenericMemoryAccess instance from a given set of 45 /// function addrs. 46 EPCGenericDylibManager(ExecutorProcessControl &EPC, SymbolAddrs SAs) 47 : EPC(EPC), SAs(SAs) {} 48 49 /// Loads the dylib with the given name. 50 Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode); 51 52 /// Looks up symbols within the given dylib. 53 Expected<std::vector<ExecutorSymbolDef>> 54 lookup(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup); 55 56 /// Looks up symbols within the given dylib. 57 Expected<std::vector<ExecutorSymbolDef>> 58 lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup); 59 60private: 61 ExecutorProcessControl &EPC; 62 SymbolAddrs SAs; 63}; 64 65} // end namespace orc 66} // end namespace llvm 67 68#endif // LLVM_EXECUTIONENGINE_ORC_EPCGENERICDYLIBMANAGER_H 69