[PATCH] D29955: Allow externally dlopen-ed libraries to be registered as permanent libraries.

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 14:15:12 PST 2017


vsk added a comment.

In https://reviews.llvm.org/D29955#683652, @marsupial wrote:

> FWIW applying https://reviews.llvm.org/D30107 before this would mean **addPermanentLibraryWithLock** would no longer be necessary.


Yeah, I didn't mean to create more work for you in https://reviews.llvm.org/D30107! The 'with-lock' helper seemed like the right solution here, and I have still have some questions/comments about https://reviews.llvm.org/D30107, hence the lgtm.

> Otherwise, doesn't this make it impossible to get symbols from an already loaded library unless all libs are searched?
>  That is, assuming **"libSomething"** is already loaded:
>  DynamicLibrary  DL = DynamicLibrary::addPermanentLibrary(dlopen(**"libSomething"**));
>  DL.getAddressOfSymbol("func"); // Fails

In that case, the client could check if DL is invalid, and then simply construct "DynamicLibrary(dlopen'd-value)". Perhaps the API could be cleaned up if we returned "Expected<DynamicLibrary>" from the static constructors, and got rid of the isValid method.

> In this case how is it possible to get symbols from **"libSomething"** without searching every loaded module?

See above.


https://reviews.llvm.org/D29955





More information about the llvm-commits mailing list