Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
ld.so/hppa: skip RELOC_NONE in the hppa fast path
To:
OpenBSD tech <tech@openbsd.org>
Date:
Fri, 06 Nov 2026 10:48:44 +0100

Download raw body.

Thread
tech@,

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.

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