[PATCH] Make the plugin loader limit its symbol search to the specified module.

Zachary Turner zturner at google.com
Fri Aug 22 11:51:43 PDT 2014


Working on LLDB, I found that they have plugin loading code which is almost identical to that provided by LLVM's support libraries.  There was one minor difference though, which is that on Apple platforms there is an RTLD_FIRST flag that you can pass to dlopen, which will limit symbol seaches to strictly the module that was dlopen'ed.  LLDB developers claim that this functionality is required to support LLDB's needs [1, 2].

The attached patch modifies LLVM's DynamicLibrary class to use RTLD_FIRST on Apple platforms, and simulate the effect on non-apple platforms by checking that the address of the located symbol is in the module which was originally dlopen'ed.

Unfortunately I don't know really how to test this, and LLVM seems to have no code that makes use of this DynamicLibrary class.

http://reviews.llvm.org/D5030

Files:
  include/llvm/Support/DynamicLibrary.h
  lib/Support/DynamicLibrary.cpp
  lib/Support/Windows/DynamicLibrary.inc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5030.12852.patch
Type: text/x-patch
Size: 3531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140822/c564ecbc/attachment.bin>


More information about the llvm-commits mailing list