[PATCH] elf: Cache full internal symbol table for relocatable input

Sam James sam@gentoo.org
Sat Oct 11 01:08:03 GMT 2025


"H.J. Lu" <hjl.tools@gmail.com> writes:

> Add bfd_elf_get_elf_syms_cached to cache internal symbol table for
> relocatable input and use the internal symbol table cache for both local
> and global symbols to avoid swapping in the same symbol table repeatedly
> for --gc-sections.  This improves linker --gc-sections speed by ~2x for
> PR ld/33530.
>
> elf_link_input_bfd is updated to not to pass preallocated buffers to
> bfd_elf_get_elf_syms_cache.

All tests pass now for me, including:

                === libctf Summary ===

# of expected passes            39
# of unsupported tests          1

I'll test it more in the wild tonight and tomorrow.


More information about the Binutils mailing list