[PATCH] make dlopen working when statically linked
Carmelo Amoroso
carmelo73 at gmail.com
Sat Feb 10 17:59:20 UTC 2007
Hi All,
I'd like to propose the attached patch that fix (at least partially)
the dlopen issue in a statically linked application.
Follow a brief analysis:
The problem is that _dl_symbol_tables is never allocated in a statically
linked app. So when dlopen calls _dl_load_shared_library[libdl.c:192]
it passes a rpnt NULL. Following the call chain, when the
_dl_load_elf_shared_library check for the *rpnt value, being NULL,
it doesn't allocate a new dyn_elf struct to be chained to the *rpnt.
Furthermore the tpnt->symbol_scope will not be initialized, and this
will cause the _dl_fixup to fail.
I tested this patch on the uClibc-nptl branch (SH4 port); anyway this
piece of code is not related to TLS, being general.
With this patch I was able to successfully run the test/dlopen/dltest.c
having same result of the glibc counterpart.
Still some issues are not solved (for example, the 'dlopened' function
call dlopen by itself), but I'm working on it.
Any comments are obviously welcome !
Best regards,
Carmelo
More information about the uClibc
mailing list