[PATCH] ld: Read the output in chunks when computing the PE build-id
Jan Beulich
jbeulich@suse.com
Fri Nov 6 10:13:57 GMT 2026
On 02.11.2026 23:59, Oleg Tolmatcev wrote:
> pecoff_checksum_contents read the output file back one byte at a time,
> seeking before every byte and passing each byte to the hash function
> separately. For a 235 MB executable this took about 15% of the link
> time.
>
> Read the file in 64 KB chunks instead.
Hmm. 64k may not seem a lot nowadays, but what if the buffer allocation
fails nevertheless? I'm again wondering whether some fallback wouldn't
be wanted. Surely that doesn't need to go down to single-byte reads
again, but having an on-stack 16-, 32-, or 64-byte buffer to cope with
very low memory may already help.
Jan
More information about the Binutils
mailing list