Subject: Re: Add a MAP_ALIGNED flag for mmap(2).
To: Matt Thomas <email@example.com>
From: Nathan J. Williams <firstname.lastname@example.org>
Date: 03/01/2003 12:24:06
Matt Thomas <email@example.com> writes:
> Currently, ld.elf_so doesn't honor the alignment specified in a
> ELF file's psections. This is due to the lack of ability to request
> an aligned block of addresses from mmap(2). I propose we add a
> MAP_ALIGNED flag which would mean that the addr argument to mmap(2)
> would be the required alignment of the block. Supplying both
> MAP_ALIGNED|MAP_FIXED would cause an error EINVAL to be returned.
> Any thought on this proposal?
I'll note that the same effect can be achieved by requesting a region
of size double-alignment (e.g. requesting a 2M region when you want 1M
alignment) and then using munmap() to trim the edges down to the
aligned region inside it. Less efficent, of course, but quite