[PATCH v9 0/13] implement dlmem() function
Szabolcs Nagy
szabolcs.nagy@arm.com
Fri Mar 31 17:12:53 GMT 2023
The 03/31/2023 20:12, stsp wrote:
> 31.03.2023 17:20, Szabolcs Nagy пишет:
> > The 03/29/2023 18:18, stsp via Libc-alpha wrote:
> > > Just to be more constructive, here is the
> > > example:
> > >
> > > void *dlopen_with_offset(const char *file, off_t offset, int flags)
> > > {
> > this api requires no libc change:
> >
> > dump the contents to a temp file and use dlopen on it.
>
> This doesn't work for my use-case.
> dlmem() can optionally preserve the destination
> mapping, which is not possible by definition with
> any file-based API.
loading from special place and loading into special place
are different things.
you gave an example of the former but then talk about the
latter.
loading from special place can be solved by writing the
contents to a temp file and loading that.
loading into special place is difficult especially if you
want to control the details of segment mapping. in case of
your dlmem design it passes down a user callback that runs
under dynamic linker locks to map segments. the interface
contract of this callback is not documented, so it can
deadlock and exposes dynamic linker internals (makes
implementation changes harder later).
if all you want is force mapping below 4G then you should
have asked for an RTLD_ flag (which may not be useful
enough or may not be supportable on all relevant targets,
but at least does not need significant loader changes).
More information about the Libc-alpha
mailing list