[Devel] dlopen(... RTLD_LOCAL vs. RTLD_GLOBAL
Bastian Friedrich
bastian.friedrich at collax.com
Fri Nov 24 09:38:27 CET 2006
Hi,
Am Mittwoch, 15. November 2006 18:17 schrieb Bastian Friedrich:
> In a nutshell: With RTLD_LOCAL (default behavior on linux), perl segfaults.
> With RTLD_GLOBAL, t_relay segfaults :((
I've dug deeper into the topic:
* Yes, a shared library that is dlopen'ed and linked against perl needs
RTLD_GLOBAL. See
http://groups.google.com/group/comp.lang.perl.misc/msg/a2877cf7e0c656fe
* If all modules but sl.so are loaded with RTLD_GLOBAL, everything is fine
* If sl.so is loaded with RTLD_GLOBAL, a segfault occurs in tm.so's code
(huh???). At least, my gdb says so ;)
I was (yet) unable to find the reason for the segfault. Thus, I'd like to
propose some options:
* Introduce a flag that lets the user configure whether RTLD_GLOBAL should be
set. See attached patch: If the user configures
'loadmodule "/my/module.so"', everything stays at it is. By appending a "G",
RTLD_GLOBAL is configured: 'loadmodule "/my/module.so G"'
* Set RTLD_GLOBAL, and fix the segfault... I expect some symbol collision, but
was unable to locate it :(
* Add an optional parameter to load_module(), plus a
| LOADMODULE STRING COMMA NUMBER
path in the config parser. You'd 'loadmodule "/my/module.so", 1' then.
* Best, but a little more difficult: open module regularly. Try to call a
function "getflags()" or something similar in that module. If it exists,
close library again and re-open it with the new flags.
Looking forward to read about your opinions!
Thx,
Bastian
--
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-24
f: +49 (0) 761-45684-10 www.collax.com
\ "In most countries selling harmful things like drugs is punishable.
\ Then howcome people can sell Microsoft software and go unpunished?"
\ Hasse Skrifvars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sr_module-patch
Type: text/x-diff
Size: 841 bytes
Desc: not available
Url : http://openser.org/pipermail/devel/attachments/20061124/43265839/sr_module-patch.bin
More information about the Devel
mailing list