[PATCH] ld: Check bfd_gc_sections return

H.J. Lu hjl.tools@gmail.com
Wed Aug 5 08:50:18 GMT 2026


bfd_gc_sections may return false on invalid input:

ld: pr34448-bug_18.o: bad reloc symbol index (0xf2000005 >= 0x13) for
offset 0x4 in section `.text.get_tls[get_tls]'

and set the BFD error to bfd_error_bad_value.  Check bfd_gc_sections
return and report the fatal error if the BFD error is bfd_error_bad_value.

PR ld/34448
* ldlang.c (lang_gc_sections): Check bfd_gc_sections return and
report the fatal error if the BFD error is bfd_error_bad_value.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ld-Check-bfd_gc_sections-return.patch
Type: text/x-patch
Size: 1295 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260805/127c9eaf/attachment.bin>


More information about the Binutils mailing list