Index: arch/hppa/hppa_reloc.c =================================================================== RCS file: /cvsroot/src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c,v retrieving revision 1.47 diff -u -p -r1.47 hppa_reloc.c --- arch/hppa/hppa_reloc.c 16 May 2020 16:43:00 -0000 1.47 +++ arch/hppa/hppa_reloc.c 16 Jul 2021 06:56:51 -0000 @@ -52,6 +52,7 @@ __RCSID("$NetBSD: hppa_reloc.c,v 1.47 20 caddr_t _rtld_bind(const Obj_Entry *, const Elf_Addr); void _rtld_bind_start(void); void __rtld_setup_hppa_pltgot(const Obj_Entry *, Elf_Addr *); +void _rtld_set_dp(Elf_Addr *); /* * It is possible for the compiler to emit relocations for unaligned data. @@ -381,6 +382,12 @@ _rtld_setup_pltgot(const Obj_Entry *obj) { Elf_Word *got = obj->pltgot; + + if (obj->mainprog) { + dbg(("setting DP to %p", obj->pltgot); + _rtld_set_dp(obj->pltgot); + } + assert(got[-2] == PLT_STUB_MAGIC1); assert(got[-1] == PLT_STUB_MAGIC2); Index: arch/hppa/rtld_start.S =================================================================== RCS file: /cvsroot/src/libexec/ld.elf_so/arch/hppa/rtld_start.S,v retrieving revision 1.13 diff -u -p -r1.13 rtld_start.S --- arch/hppa/rtld_start.S 10 May 2020 06:42:38 -0000 1.13 +++ arch/hppa/rtld_start.S 16 Jul 2021 06:56:51 -0000 @@ -231,3 +231,9 @@ ENTRY(_rtld_bind_start,HPPA_FRAME_SIZE) bv %r0(%r21) nop EXIT(_rtld_bind_start) + + +LEAF_ENTRY_NOPROFILE(_rtld_set_dp) + bv %r0(%rp) + copy %arg0, %dp +EXIT(_rtld_set_dp)