[PATCH v4 3/6] elf: Use mmap to map in read-only sections
H.J. Lu
hjl.tools@gmail.com
Fri Mar 8 15:25:09 GMT 2024
On Thu, Mar 7, 2024 at 4:40 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Mar 06, 2024 at 03:23:58PM -0800, H.J. Lu wrote:
> > Add _bfd_mmap_readonly_tracked and _bfd_mmap_readonly_untracked to mmap
> > in reado-only sections with size >= 4 * page size.
>
> These are better names than in the original patch, but I'm thinking
> that _bfd_mmap_persistent, _bfd_mmap_temporary and
> _bfd_munmap_temporary or some variation on that might better reflect
> their use.
Changed.
> > (setup_group): Call _bfd_mmap_readonly_tracked instead of
> > _bfd_alloc_and_read to map in the group section as read-only
> > and allocate the memory for internal use separately.
>
> I doubt you will usually get to the minimum mmap size for SHT_GROUP
> sections. So this change will often require a malloc'd buffer for
> section contents. (The internal buffer is always at least as large as
> the section contents. The current code uses the same buffer for both
> external section contents and the internal representation.) So I
> think it is better to continue to use _bfd_alloc_and_read here.
Dropped.
> Other than that, this is OK.
>
Thanks.
--
H.J.
More information about the Binutils
mailing list