This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: how to force C++ objects to an address? (ABI issue B-7)
Anthony Heading <aheading@jpmorgan.com> writes:
> Clutching at straws, if a .so file was already mmap'd into a processes
> address space, is there any chance that a subsequent dlopen would
> decide to use that existing copy? (Hmm - that sounds a bit unlikely)
That sounds pretty tough to me. The dynamic linker has to apply the
dynamic relocations when dlopen is called on a shared library. If a
the library is already mapped into memory, dlopen would have to start
modifying it. That would seem to violate natural expectations of how
mmap should work.
> Alternatively, if one were to think about changing Linux to support
> this - e.g. creating a variant on dlopen that took an address, or
> maybe better using the (unused?) physical address field in the
> program headers to indicate where a library should be loaded, or
> perhaps less intrusively an extra section to supply that information,
> is it realistic to hope this might be acceptable for the wider world?
It seems like a reasonable extension to me. I think the natural
approach would be a new version of dlopen. Using the physical address
field doesn't sound right to me. Adding a new program header type to
carry the required address ought to work, and would be useful since it
wouldn't require dlopen. The place to change would be elf/dl-load.c
in glibc.
Ian