[PATCH] D30107: Refactor DynamicLibrary so searching for a symbol will have a defined order and libraries are properly unloaded when llvm_shutdown is called.
Frederich Munch via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 10:00:10 PDT 2017
marsupial added a comment.
Lets take a simple example of **libRuntime.so**, **libA.so**, **libB.so**.
**libRuntime.so** is linked to the binaries and contains stdlib functions, such as **printf**.
**libA.so**, and **libB.so** also contain a locally exported symbols **printf**, **doSomething**
DynamicLibrary::getPermanentLibrary(NULL)
DynamicLibrary::getPermanentLibrary("libA.so")
X = DynamicLibrary::SearchForAddressOfSymbol("doSomething")
DynamicLibrary::getPermanentLibrary("libB.so")
Y = DynamicLibrary::SearchForAddressOfSymbol("doSomething")
Z = DynamicLibrary::SearchForAddressOfSymbol("printf")
Prior to this patch X was the only defined behavior, guaranteed to be from **libA.so**
Y, and Z could be resolved from any of **libRuntime.so**, **libA.so**, **libB.so** and not necessarily consistent across launches.
Now:
X always comes from **libA.so**
Y always comes from **libB.so**
Z always comes from **libRuntime.so**
Repository:
rL LLVM
https://reviews.llvm.org/D30107
More information about the llvm-commits
mailing list