https://sourceware.org/bugzilla/show_bug.cgi?id=29355
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alan Modra <amo...@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=35c5dcc666082f0edf6dd559e46b98d0e7986a2e commit 35c5dcc666082f0edf6dd559e46b98d0e7986a2e Author: Alan Modra <amo...@gmail.com> Date: Tue Jul 12 10:51:52 2022 +0930 PR29355, ld segfaults with -r/-q and custom-named section .rela* The bug testcase uses an output section named .rel or .rela which has input .data sections mapped to it. The input .data section has relocations. When counting output relocations SHT_REL and SHT_RELA section reloc_count is ignored, with the justification that reloc sections themselves can't have relocations and some backends use reloc_count in reloc sections. However, the test wrongly used the output section type (which normally would match input section type). Fix that. Note that it is arguably wrong for ld to leave the output .rel/.rela section type as SHT_REL/SHT_RELA when non-empty non-reloc sections are written to it, but I'm not going to change that since it might be useful to hand-craft relocs in a data section that is then written to a SHT_REL/SHT_RELA output section. PR 29355 * elflink.c (bfd_elf_final_link): Use input section type rather than output section type to determine whether to exclude using reloc_count from that section. -- You are receiving this mail because: You are on the CC list for the bug.