[PATCH] D33529: Allow Unix libraries loaded with RTLD_LOCAL to be searched.

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 07:28:23 PDT 2017


marsupial added inline comments.


================
Comment at: lib/Support/DynamicLibrary.cpp:85
+#if defined(LLVM_ON_WIN32) && !defined(NDEBUG)
       for (void *Handle : Handles)
         assert(!DLSym(Handle, Symbol) && "Symbol exists in non process handle");
----------------
v.g.vassilev wrote:
> I am a little confused by this section here. This seems well optimized for binaries which are statically linked.
> 
> IIUC we disallow searching symbols from the dlopened from the process libraries? Why?
Yes it's a bit uglier than needed...I can fix that.

The point is ROOT seems to be the only user of addPermanentLibrary which is the only way to inject a handle of RTLD_LOCAL.

As such searching the **Process** handle will in cases other than ROOT will have already searched all libs that are in **Handles**.  Which means you've slowed things down for nonexistent symbols 2x for all users to accommodate your special needs.

I can understand that you have a desire outside normal usage in LLVM but think it's better to have an argument to explicitly search any RTLD_LOCAL in **Handles** rather than require it for everyone.



https://reviews.llvm.org/D33529





More information about the llvm-commits mailing list