[PATCH 0/4] elf: Use mmap to map in section contents

H.J. Lu hjl.tools@gmail.com
Wed Mar 6 16:16:54 GMT 2024


On Tue, Mar 5, 2024 at 4:51 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Mar 05, 2024 at 09:00:53AM -0800, H.J. Lu wrote:
> > We can use mmap to map in ELF section contents, instead of copying them
> > into memory by hand.  We don't need to cache symbol nor relocation tables
> > if they are mapped in.  Data to link the 3.5GB clang executable in LLVM
> > 17 debug build on Linux/x86-64 with 32GB RAM is:
>
> I like the idea.  Some comments on the patch:
> - You should probably replace occurrences of HAVE_MMAP with USE_MMAP,
>   and change the config default for --with-mmap.

Fixed.

> - There doesn't seem to be any reason to have an asize parameter to
>   _bfd_mmap_readonly_tracked if you are going to give an error on
>   unterminated string tables.  (BTW, I don't disagree with giving an
>   error.)

Fixed.

> - Can you put contents_addr in bfd_elf_section_data rather than
>   bfd_section so that the extra pointer doesn't affect non-ELF
>   targets?

Fixed.

> - _bfd_link_keep_memory should probably be moved to elflink.c, renamed
>   to _elf_link_keep_memory and declared in elf-bfd.h.
>

I renamed it to _bfd_elf_link_keep_memory.

Here is the v2 patch:

https://patchwork.sourceware.org/project/binutils/list/?series=31657

Thanks.

-- 
H.J.


More information about the Binutils mailing list