Subject: Re: speeding up ld.elf_so
To: David Laight <david@l8s.co.uk>
From: Chuck Silvers <chuq@chuq.com>
List: tech-perform
Date: 08/25/2002 16:04:04
On Sat, Aug 24, 2002 at 09:31:10PM +0100, David Laight wrote:
> Note that there are 3 NAMI calls for the shared library, and a 4k read
> before the file is mapped.
> ISTM that there could easily be a measurable improvement if NAMI was
> only done once. It also removes any possible race conditions caused
> by someone moving the file.
> Also isn't using mmap() likely to be better than the 4k read?
>
> The start point would be to make _rtld_find_library return an open fd.
> if looks as though it is always called:
> path = _rtld_find_library( name, obj );
> if (!path)
> error(...)
> new_obj = _rtld_load_object( path, ... );
> So passing through the open fd wouldn't be too hard.
>
> The read(fd, u.buf, PAGESIZE ) is in _rtld_map_object and could trivially
> be changed to an mmap.
these seem reasonable.
> The only slight difficulty is that there isn't (yet?) a flag to open()
> to say 'only open a regular file' (or do you want to be able to
> dlopen() anything that supported mmap?)
> (O_NONBLOCK might be enough - or just leave it a caveat emptor.)
why shouldn't one be to store a shared library in (eg.) a memory-mapped
flash card? if the user has permission to open the device, let him.
there's no security issue here.
> Thoughts?
> I don't fancy testing this one, unless someone can suggest how to
> run a program with an alternate loader?
there's a "--dynamic-linker" option to ld that lets you specify the
interpreter to use.
-Chuck