3 ms·
I don't think you can do this with traditional dynamic linkers — the separate memory space is not so difficult (requires relocatable libraries, -fPIC, which is
by loeg 8y ago
I don't think you can do this with traditional dynamic linkers — the separate memory space is not so difficult (requires relocatable libraries, -fPIC, which is usually already enabled on ASLR systems) — but you would want to be able to load the same .so twice without symbol naming conflicts. I don't think most dynamic linkers (ld-linux / rtld-elf) support that. I could be mistaken, I am not very familiar with any implementation.
There is nothing preventing you from adding this support to an existing dynamic linker and using it for your program, though.
- nybble41 8y ago> but you would want to be able to load the same .so twice without symbol naming conflicts This is supported in ld-linux by using the dlmopen() glibc function and distinct namespaces. Loading the same .so file multiple times is one of the use cases explicitly mentioned in the manual page[1]. [1]: http://man7.org/linux/man-pages/man3/dlmopen.3.html#NOTES http://man7.org/linux/man-pages/man3/dlmopen.3.html#NOTES
- loeg 8y agoThanks, I wasn't aware of that! One caveat seems to be: > The glibc implementation supports a maximum of 16 namespaces.