]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR 33676 ld segfaults when using binary input inside NOLOAD
authorMagnus Wållberg <magnus@tagpad.net>
Mon, 8 Dec 2025 09:33:40 +0000 (20:03 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 8 Dec 2025 09:38:58 +0000 (20:08 +1030)
commitce2197f48d59db89f9ce4c2adfd9d47f0730ecc8
tree5ea6c24590db1024fd4eb75c91a33f32b404e9ac
parent44b79abd0fa12e7947252eb4c6e5d16ed6033e01
PR 33676 ld segfaults when using binary input inside NOLOAD

The code at ldlang.c:2840-2841 checks if the output BFD is ELF format,
then unconditionally uses elf_section_type() on the input section
without verifying the input section is also ELF format.

This was introduced in commit d87be451e (PR ld/32787) which added
special handling for NOLOAD note sections.

PR 33676
PR 32787
* ldlang.c (lang_add_section): Check section owner's BFD
flavour before using elf_section_type.
ld/ldlang.c