public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org, goldstein.w.n@gmail.com
Subject: Re: [PATCH v4 3/6] elf: Use mmap to map in read-only sections
Date: Fri, 8 Mar 2024 11:10:05 +1030	[thread overview]
Message-ID: <ZepeZU0RGwmWQ6qR@squeak.grove.modra.org> (raw)
In-Reply-To: <20240306232401.1408530-4-hjl.tools@gmail.com>

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.

> 	(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.

Other than that, this is OK.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2024-03-08  0:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 23:23 [PATCH v4 0/6] elf: Use mmap to map in section contents H.J. Lu
2024-03-06 23:23 ` [PATCH v4 1/6] bfd: Don't hard-code BFD_JUMP_TABLE_COPY H.J. Lu
2024-03-07 22:46   ` Alan Modra
2024-03-06 23:23 ` [PATCH v4 2/6] bfd: Change the --with-mmap default to true H.J. Lu
2024-03-07 22:46   ` Alan Modra
2024-03-06 23:23 ` [PATCH v4 3/6] elf: Use mmap to map in read-only sections H.J. Lu
2024-03-08  0:40   ` Alan Modra [this message]
2024-03-08 15:25     ` H.J. Lu
2024-03-06 23:23 ` [PATCH v4 4/6] elf: Add _bfd_elf_mmap_section and _bfd_elf_munmap_section_contents H.J. Lu
2024-03-08  0:41   ` Alan Modra
2024-03-08 15:28     ` H.J. Lu
2024-03-08 17:03       ` H.J. Lu
2024-03-08  0:50   ` Sam James
2024-03-08  3:33     ` Alan Modra
2024-03-06 23:24 ` [PATCH v4 5/6] elf: Use mmap to map in symbol and relocation tables H.J. Lu
2024-03-08  0:42   ` Alan Modra
2024-03-08 15:36     ` H.J. Lu
2024-03-09 16:34       ` H.J. Lu
2024-03-06 23:24 ` [PATCH v4 6/6] elf: Don't cache symbol nor relocation tables with mmap H.J. Lu
2024-03-08  0:43   ` Alan Modra
2024-03-08  0:48   ` Sam James
2024-03-08 15:31     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZepeZU0RGwmWQ6qR@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=goldstein.w.n@gmail.com \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).