From: ASOU Masato Subject: Re: ld.so not calling destructor To: Alexander Bluhm Cc: tech@openbsd.org, Philip Guenther Date: Fri, 17 Jan 2025 14:24:12 +0900 On Fri, Jan 17, 2025 at 2:19 PM ASOU Masato wrote: > > I applied your patch and following diff: > > diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c > index 43b19855551..53df24cf857 100644 > --- a/libexec/ld.so/library_subr.c > +++ b/libexec/ld.so/library_subr.c > @@ -457,7 +457,8 @@ _dl_child_refcnt_decrement(elf_object_t *object) > struct object_vector vec; > int i; > > - object->refcount--; > + if (object->refcount > 0) > + object->refcount--; > if (OBJECT_REF_CNT(object) == 0) > for (vec = object->child_vec, i = 0; i < vec.len; i++) > _dl_child_refcnt_decrement(vec.vec[i]); The following three lines are unnecessary. > @@ -532,6 +533,17 @@ _dl_link_child(elf_object_t *dep, elf_object_t *p) > p->load_name)); > } -- ASOU Masato