mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
Reland r296442 with modifications reverted in r296463.
Original commit message: "Allow externally dlopen-ed libraries to be registered as permanent libraries. This is also useful in cases when llvm is in a shared library. First we dlopen the llvm shared library and then we register it as a permanent library in order to keep the JIT and other services working. Patch reviewed by Vedant Kumar (D29955)!" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -76,6 +76,18 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
|
||||
return DynamicLibrary(handle);
|
||||
}
|
||||
|
||||
DynamicLibrary DynamicLibrary::addPermanentLibrary(void *handle,
|
||||
std::string *errMsg) {
|
||||
SmartScopedLock<true> lock(*SymbolsMutex);
|
||||
// If we've already loaded this library, tell the caller.
|
||||
if (!OpenedHandles->insert(handle).second) {
|
||||
if (errMsg) *errMsg = "Library already loaded";
|
||||
return DynamicLibrary();
|
||||
}
|
||||
|
||||
return DynamicLibrary(handle);
|
||||
}
|
||||
|
||||
void *DynamicLibrary::getAddressOfSymbol(const char *symbolName) {
|
||||
if (!isValid())
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user