From: Indu Bhagat Date: Fri, 12 Dec 2025 15:02:32 +0000 (+0200) Subject: bfd: ld: sframe: skip R_*_NONE relocations from input bfds X-Git-Tag: binutils-2_46~614 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db5b3831be576aee7df6f32a3fdc64bd7667686e;p=thirdparty%2Fbinutils-gdb.git bfd: ld: sframe: skip R_*_NONE relocations from input bfds Fix PR ld/33401 - SFrame assertion when linking gav-0.9.1 As the issue demonstrates, R_*_NONE relocations are not necessarily at the end of .sframe section (previously thought so with PR ld/33127). Skip over R_*_NONE relocs when they are strewn intermittently inside the .rela.sframe section. bfd/ PR ld/33401 * elf-sframe.c (sframe_decoder_init_func_bfdinfo): Skip over R_*_NONE relocations. --- diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c index 8e4cfdd73d3..80043550777 100644 --- a/bfd/elf-sframe.c +++ b/bfd/elf-sframe.c @@ -121,13 +121,24 @@ sframe_decoder_init_func_bfdinfo (bfd *abfd, return true; rel = cookie->rels; + unsigned int reloc_index = 0; for (i = 0; i < fde_count; i++) { /* Bookkeep the relocation offset and relocation index of each function - for later use. */ + for later use. There may be some R_*_NONE relocations intermingled + (see PR ld/33401). Skip over those. */ + while (rel->r_info == 0) + { + reloc_index++; + rel++; + } + + BFD_ASSERT (reloc_index < sec->reloc_count); + sframe_decoder_set_func_r_offset (sfd_info, i, rel->r_offset); - sframe_decoder_set_func_reloc_index (sfd_info, i, i); + sframe_decoder_set_func_reloc_index (sfd_info, i, reloc_index); + reloc_index++; rel++; }