From: Miod Vallat Subject: Re: ld.so/hppa: skip RELOC_NONE in the hppa fast path To: "Kirill A. Korinsky" Cc: OpenBSD tech Date: Fri, 6 Nov 2026 17:13:10 +0000 > my quest with building gcc-16 at hppa allow me discvoer that BFD can include > RELOC_NONE in DT_RELACOUNT. > > Let skip them in the fast relocation loop, matching the normal loop, that > actually prevents a crash or how had I discovered this. Sure, but that logic should probably be added to other platforms as they might get bitten by the same problem eventually. > Index: hppa/rtld_machine.c > =================================================================== > RCS file: /cvs/src/libexec/ld.so/hppa/rtld_machine.c,v > diff -u -p -r1.45 rtld_machine.c > --- hppa/rtld_machine.c 16 Jul 2026 11:21:37 -0000 1.45 > +++ hppa/rtld_machine.c 6 Nov 2026 09:44:28 -0000 > @@ -153,7 +153,11 @@ _dl_md_reloc(elf_object_t *object, int r > > /* tight loop for leading relative relocs */ > for (i = 0; i < num_relative; i++, rela++) { > - Elf_Addr *where = (Elf_Addr *)(rela->r_offset + loff); > + Elf_Addr *where; > + > + if (ELF_R_TYPE(rela->r_info) == RELOC_NONE) > + continue; > + where = (Elf_Addr *)(rela->r_offset + loff); > *where = rela->r_addend + loff; > } > for (; i < numrela; i++, rela++) { > > > -- > wbr, Kirill >