[PATCH] bfd: Add bfd_update_error to handle memory exhaustion

Jan Beulich jbeulich@suse.com
Mon Oct 27 16:54:39 GMT 2025


On 18.10.2025 03:03, H.J. Lu wrote:
> Add bfd_update_error and update bfd_check_format_matches to handle memory
> exhaustion.  This changes linker error message from
> 
> ld:lib/libLLVMTransformUtils.a: file format not recognized; treating
> as linker script
> ld:lib/libLLVMTransformUtils.a:1: syntax error
> 
> to
> 
> ld: lib/libLLVMTransformUtils.a: file not recognized: memory exhausted
> 
> when linking the 3.1GB clang executable in LLVM 21 debug build with the
> 32-bit linker.
> 
> PR ld/33550
> * archive.c (bfd_generic_archive_p): Call bfd_update_error if
> failed to read armap.
> * bfd-in2.h: Regenerated.
> * bfd.c (bfd_update_error): New.
> * format.c (bfd_check_format_matches): Go out if memory is
> exhausted.

For this last change, aren't we then at risk of bailing out when really
a later target could have matched (without running oom)? Also, why is
bfd_error_system_call special in bfd_update_error() but not here?

Jan


More information about the Binutils mailing list