binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
bfd

bfd: Prevent crash when linking incompatible XCOFF architectures

bfd: Fix null pointer dereference in XCOFF linking for incompatible architectures.

The binutils linker now correctly handles linking XCOFF object files with incompatible architectures. Previously, when a mismatch occurred, the linker would continue processing and attempt to dereference null pointers for magic sections, leading to a segmentation fault. This change adds checks to ensure these sections are not null before accessing their size, preventing the crash.

In Details

The bfd_xcoff_build_dynamic_sections function in bfd/xcofflink.c dereferenced linkage_section, toc_section, and descriptor_section without checking if they were NULL. These sections are only created when the input and output XCOFF vectors match. When linking foreign architectures, they remain NULL, causing a crash. The fix checks for NULL before dereferencing, aligning with _bfd_xcoff_bfd_final_link.

Filed Under: linkerXCOFFcrash fix