Add RTLD_GLOBAL to dlopen

Hi,

Today, I've made the transition from LLVM 2.1 to 2.3. I invoke opt with two dynamic libraries to "-load", the first of which contains transformation passes and support code whereas the second one provides extra passes which make use of the first library's support code. In other words, the symbols loaded in for the first library should be available when the second library is loaded.

In LLVM 2.1, this approach worked, but I noticed that the DynamicLibrary::LoadLibraryPermanently(...) implementation in $LLVM/lib/System/DynamicLibrary.cpp has been altered for LLVM 2.3. The rewrite does not make loaded symbols available for future loaded libraries.

Changing on line 64:

void *H = dlopen(Filename, RTLD_LAZY);

... into ...

void *H = dlopen(Filename, RTLD_LAZY | RTLD_GLOBAL);

fixes this. Could this change be incorporated into future releases? Thanks in advance!

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)

Today, I've made the transition from LLVM 2.1 to 2.3. I invoke opt
with two dynamic libraries to "-load", the first of which contains
transformation passes and support code whereas the second one provides
extra passes which make use of the first library's support code. In
other words, the symbols loaded in for the first library should be
available when the second library is loaded.

Sure, applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080707/064842.html

-Chris

In LLVM 2.1, this approach worked, but I noticed that the
DynamicLibrary::LoadLibraryPermanently(...) implementation in $LLVM/
lib/System/DynamicLibrary.cpp has been altered for LLVM 2.3. The
rewrite does not make loaded symbols available for future loaded
libraries.

Changing on line 64:

void *H = dlopen(Filename, RTLD_LAZY);

... into ...

void *H = dlopen(Filename, RTLD_LAZY | RTLD_GLOBAL);

fixes this. Could this change be incorporated into future releases?
Thanks in advance!

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

Hi,