This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Loading Shared Object from memory
- From: "Alexander Schmitt" <alexander dot schmitt at wibu dot com>
- To: <libc-help at sourceware dot org>
- Date: Fri, 28 May 2010 21:27:42 +0200
- Subject: Loading Shared Object from memory
Hi,
I want to load a shared object from memory out of another ELF binary
(app or SO). For this the SO is stored e.g. in a byte array of the
base ELF binary. The byte array contains the SO as it is stored in a
file on disk. During runtime I want to load this SO WITHOUT storing
it temporary on disk! If I would do this I can make this with
dlopen(), etc.
Another idea is that I can map the segments of the SO into memory
and do the work of dlopen() by my own. But this seems to be a lot of
work and is in my opinion very error prone.
Now the question is: Is there a way to run the already loaded
ld-linux.so twice over the new mapped SO? The entry point of the
loaded ld-linux.so I can get with dlopen() + dladdr(). But if I
currently do this out the base ELF binary a SegFault is occurring.
Or is there an easier way to do this at all?
Thank is advance,
Alex