[PATCH] bfd: Add bfd_update_error to handle memory exhaustion

H.J. Lu hjl.tools@gmail.com
Sat Oct 18 01:03:52 GMT 2025


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.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bfd-Add-bfd_update_error-to-handle-memory-exhaustion.patch
Type: text/x-patch
Size: 3216 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20251018/ea2020f3/attachment.bin>


More information about the Binutils mailing list