member of RTDyldMemoryManager (and rename to getSymbolAddressInProcess).
The functionality this provides is very specific to RTDyldMemoryManager, so it
makes sense to keep it in that class to avoid accidental re-use.
No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218741
91177308-0d34-0410-b5e6-
96231b3b80d8
class ExecutionEngine;
class ObjectImage;
class ExecutionEngine;
class ObjectImage;
-uint64_t getSymbolAddress(const std::string &Name);
-
// RuntimeDyld clients often want to handle the memory management of
// what gets placed where. For JIT clients, this is the subset of
// JITMemoryManager required for dynamic loading of binaries.
// RuntimeDyld clients often want to handle the memory management of
// what gets placed where. For JIT clients, this is the subset of
// JITMemoryManager required for dynamic loading of binaries.
virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size);
virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size);
+ /// This method returns the address of the specified function or variable in
+ /// the current process.
+ static uint64_t getSymbolAddressInProcess(const std::string &Name);
+
/// This method returns the address of the specified function or variable.
/// It is used to resolve symbols during module linking.
virtual uint64_t getSymbolAddress(const std::string &Name) {
/// This method returns the address of the specified function or variable.
/// It is used to resolve symbols during module linking.
virtual uint64_t getSymbolAddress(const std::string &Name) {
- return llvm::getSymbolAddress(Name);
+ return getSymbolAddressInProcess(Name);
}
/// This method returns the address of the specified function. As such it is
}
/// This method returns the address of the specified function. As such it is
#undef ARM_MATH_DECL
#endif
#undef ARM_MATH_DECL
#endif
-uint64_t getSymbolAddress(const std::string &Name) {
+uint64_t
+RTDyldMemoryManager::getSymbolAddressInProcess(const std::string &Name) {
// This implementation assumes that the host program is the target.
// Clients generating code for a remote target should implement their own
// memory manager.
// This implementation assumes that the host program is the target.
// Clients generating code for a remote target should implement their own
// memory manager.
// Demonstrate that getSymbolAddress accepts mangled names and always strips
// the leading underscore.
// Demonstrate that getSymbolAddress accepts mangled names and always strips
// the leading underscore.
- EXPECT_EQ(reinterpret_cast<uint64_t>(&x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));
}
TEST_F(ExecutionEngineTest, LookupWithMangledAndDemangledSymbol) {
}
TEST_F(ExecutionEngineTest, LookupWithMangledAndDemangledSymbol) {
// Lookup the demangled name first, even if there's a demangled symbol that
// matches the input already.
// Lookup the demangled name first, even if there's a demangled symbol that
// matches the input already.
- EXPECT_EQ(reinterpret_cast<uint64_t>(&x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));
}
TEST_F(ExecutionEngineTest, LookupwithDemangledName) {
}
TEST_F(ExecutionEngineTest, LookupwithDemangledName) {
llvm::sys::DynamicLibrary::AddSymbol("_x", &_x);
// But do fallback to looking up a demangled name if there's no ambiguity
llvm::sys::DynamicLibrary::AddSymbol("_x", &_x);
// But do fallback to looking up a demangled name if there's no ambiguity
- EXPECT_EQ(reinterpret_cast<uint64_t>(&_x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&_x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));