[lldb-dev] dlsym() and RTLD_FIRST
Enrico Granata
egranata at apple.com
Thu Aug 21 15:40:14 PDT 2014
I found this old email from Greg online: http://comments.gmane.org/gmane.comp.debugging.lldb.devel/305
His claim is that without RTLD_FIRST:
> FileSpec plugin_spec ("/plugins/disassembler.dylib");
> void *lib_handle = Host::DynamicLibraryOpen (plugin_spec, error);
> if (lib_handle)
> {
> void *init_callback = Host::DynamicLibraryGetSymbol (lib_handle, "InitPlugin", error);
> if (init_callback)
> {
> // Now on linux we might have a function that comes from another shared library...
> }
> }
The documentation is indeed fairly scarce on the subject of how things might go wrong without the flag.. but the description seems compelling enough that I’d like to keep it..
> On Aug 21, 2014, at 3:31 PM, Zachary Turner <zturner at google.com> wrote:
>
> Can someone explain this flag to me? I've read the documentation, but it's still not clear to me. If you ask dlsym() to search some module X, why would it ever search modules other than X?
>
> The reason I ask about this is that llvm support library already has a DynamicLibrary class whose purpose almost exactly matches what we're using the Host::DynamicLibrary related functions for. However, it doesn't use the RTLD_FIRST flag, and so I'm not sure what the implications are of us using it and deleting our own DynamicLibrary code.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
Thanks,
- Enrico
📩 egranata@.com ☎️ 27683
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140821/deee3652/attachment.html>
More information about the lldb-dev
mailing list