summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Support/DynamicLibrary.h
diff options
context:
space:
mode:
authorFrederich Munch <colsebas@hotmail.com>2017-04-27 16:55:24 +0000
committerFrederich Munch <colsebas@hotmail.com>2017-04-27 16:55:24 +0000
commitc1db8cf9c1ddf2a113312b81e467fcd5b6f30194 (patch)
tree8076ffd8cd6c278b852bcf077ec6b7ba74c4978b /llvm/include/llvm/Support/DynamicLibrary.h
parentd21601a92917f5d353d3cb0e51b48e07f85ded8e (diff)
downloadbcm5719-llvm-c1db8cf9c1ddf2a113312b81e467fcd5b6f30194.tar.gz
bcm5719-llvm-c1db8cf9c1ddf2a113312b81e467fcd5b6f30194.zip
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called. Summary: This was mostly affecting usage of the JIT, where storing the library handles in a set made iteration unordered/undefined. This lead to disagreement between the JIT and native code as to what the address and implementation of particularly on Windows with stdlib functions: JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv Native: getenv("TEST") -> NULL // called ucrt.dll, getenv Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows not giving priority to the process' symbols as it did on Unix. Reviewers: chapuni, v.g.vassilev, lhames Reviewed By: lhames Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D30107 llvm-svn: 301562
Diffstat (limited to 'llvm/include/llvm/Support/DynamicLibrary.h')
-rw-r--r--llvm/include/llvm/Support/DynamicLibrary.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/DynamicLibrary.h b/llvm/include/llvm/Support/DynamicLibrary.h
index aa9bb8938ad..a8874a10d46 100644
--- a/llvm/include/llvm/Support/DynamicLibrary.h
+++ b/llvm/include/llvm/Support/DynamicLibrary.h
@@ -58,7 +58,7 @@ namespace sys {
void *getAddressOfSymbol(const char *symbolName);
/// This function permanently loads the dynamic library at the given path.
- /// The library will only be unloaded when the program terminates.
+ /// The library will only be unloaded when llvm_shutdown() is called.
/// This returns a valid DynamicLibrary instance on success and an invalid
/// instance on failure (see isValid()). \p *errMsg will only be modified
/// if the library fails to load.
@@ -71,7 +71,8 @@ namespace sys {
/// Registers an externally loaded library. The library will be unloaded
/// when the program terminates.
///
- /// It is safe to call this function multiple times for the same library.
+ /// It is safe to call this function multiple times for the same library,
+ /// though ownership is only taken if there was no error.
///
/// \returns An empty \p DynamicLibrary if the library was already loaded.
static DynamicLibrary addPermanentLibrary(void *handle,
@@ -106,6 +107,8 @@ namespace sys {
/// libraries.
/// @brief Add searchable symbol/value pair.
static void AddSymbol(StringRef symbolName, void *symbolValue);
+
+ class HandleSet;
};
} // End sys namespace
OpenPOWER on IntegriCloud