From: Alexander Bluhm Subject: Re: ld.so not calling destructor To: ASOU Masato Cc: tech@openbsd.org, Philip Guenther Date: Thu, 13 Feb 2025 10:13:14 +0100 On Thu, Feb 13, 2025 at 04:25:07PM +0900, ASOU Masato wrote: > On Wed, Feb 12, 2025 at 9:56???PM Alexander Bluhm wrote: > > > > On Fri, Jan 17, 2025 at 02:24:12PM +0900, ASOU Masato wrote: > > > On Fri, Jan 17, 2025 at 2:19???PM ASOU Masato wrote: > > > > I applied your patch and following diff: > > > > With a slightly different patch for ld.so, only run-regress-prog1 > > of regress is failing. I moved down the call to _dl_unlink_children() > > a bit. Also with this fix, a workaround a patch for llvm-openmp > > can be removed. It seems that the callbacks are called in the right > > order now. > > > > Nevertheless, the failing regress looks relevant regarding ordering > > of destructors and needs more thoughts. > > > > bluhm > > Maybe I found the cause of this problem. I think it's a problem with > the `next' and `prev' opelations below: > > struct elf_object { > > struct elf_object *next; > struct elf_object *prev; > > Please give me some more time. Take your time. I am very happy that you are helping. Note that I have removed patch-runtime_src_kmp_runtime_cpp from llvm-openmp port that deals with the wrong callback order. I think it was only necessary because I messed up the ordering in my first ld.so diff. If we need it in the end, we can put it back. bluhm