[PATCH v2] ld: Read the output in chunks when computing the PE build-id

Jan Beulich jbeulich@suse.com
Fri Nov 13 09:27:15 GMT 2026


On 06.11.2026 21:33, 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 using a 64 KB heap buffer.  If its allocation fails,
> fall back to a 64-byte buffer on the stack.
> 
> ld/
> 	* emultempl/pe.em (pecoff_checksum_contents): Read the file in
> 	chunks, with a stack buffer fallback.
> 	* emultempl/pep.em (pecoff_checksum_contents): Likewise.

Okay.

Jan


More information about the Binutils mailing list