[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 19:21:41 PDT 2017
marsupial added a comment.
> Exactly, so there is no way to override the symbol at run-time. This counter-intuitive (well wrong in my opinion) in an interactive-compiler.
I understand you folks feel it is wrong and I have been trying to work towards a solution.
But there are other use cases besides yours.
The problem I have and why I think it is not //well wrong//:
**libc++.so**, **libA.so**
**libA.so** defines an overload for global **operator new/delete**
DynamicLibrary::getPermanentLibrary(NULL)
// Other code
DynamicLibrary::getPermanentLibrary("libA.so")
In your scheme the JIT can pull **operator new/delete** from **libA.so**, and worse is that whether it pulls **operator new/delete** from **libA.so** is dependent on whether **operator new/delete** has been resolved in **// Other code** before **libA.so** has been loaded.
While not undefined behavior, in the setting of **// Other code** involving an interactive-compiler it could easily lead to behavior/bugs that would be hard to understand/debug.
By making order follow what the OS would do as much as possible by default this problem can be somewhat mitigated.
And can we please continue at https://reviews.llvm.org/D33529 which is devoted to this issue.
Repository:
rL LLVM
https://reviews.llvm.org/D30107
More information about the llvm-commits
mailing list