aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/DynamicLibrary.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2017-02-28 10:15:18 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2017-02-28 10:15:18 +0000
commit3d369cbae39a55b11383496f46f11812f0823cdb (patch)
treea8e85272a9c96ce33cccc156efc4dfd84eb632e9 /llvm/lib/Support/DynamicLibrary.cpp
parent9d07094913b77014d260ff7ca8867595b171db17 (diff)
downloadllvm-3d369cbae39a55b11383496f46f11812f0823cdb.zip
llvm-3d369cbae39a55b11383496f46f11812f0823cdb.tar.gz
llvm-3d369cbae39a55b11383496f46f11812f0823cdb.tar.bz2
Revert r296442 (and r296443), "Allow externally dlopen-ed libraries to be registered as permanent libraries."
It broke clang/test/Analysis/checker-plugins.c llvm-svn: 296463
Diffstat (limited to 'llvm/lib/Support/DynamicLibrary.cpp')
-rw-r--r--llvm/lib/Support/DynamicLibrary.cpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp
index d3983fb..74d94d3 100644
--- a/llvm/lib/Support/DynamicLibrary.cpp
+++ b/llvm/lib/Support/DynamicLibrary.cpp
@@ -68,34 +68,10 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
handle = RTLD_DEFAULT;
#endif
- DynamicLibrary dyLib = addPermanentLibraryWithLock(handle, lock, !filename);
-
// If we've already loaded this library, dlclose() the handle in order to
// keep the internal refcount at +1.
- if (!dyLib.isValid()) {
- if (errMsg)
- *errMsg = (filename) ? std::string(filename) : std::string() +
- ": Library already loaded";
+ if (!OpenedHandles->insert(handle).second)
dlclose(handle);
- }
-
- return dyLib;
-}
-
-DynamicLibrary DynamicLibrary::addPermanentLibrary(void *handle) {
- SmartScopedLock<true> lock(*SymbolsMutex);
- return addPermanentLibraryWithLock(handle, lock, false);
-}
-
-DynamicLibrary DynamicLibrary::addPermanentLibraryWithLock(void *handle,
- sys::SmartScopedLock<true> &,
- bool isMainExec) {
- // If we've already loaded this library, tell the caller.
- // FIXME: Note that multiple requests for adding the main executable is not
- // considered as an error. If we don't want to treat the main executable as a
- // special case we need to do a cleanup in the MCJIT tests and API.
- if (!OpenedHandles->insert(handle).second && !isMainExec)
- return DynamicLibrary();
return DynamicLibrary(handle);
}