Re: ld.so initarray support

2016-08-23 Thread Philip Guenther
On Tue, Aug 23, 2016 at 6:59 AM, Mark Kettenis wrote: >> Date: Mon, 22 Aug 2016 21:27:51 -0700 >> From: Philip Guenther >> >> Right now, DT_NUM is defined in , but that's dumb: it >> should be moved immediately to libexec/ld.so/resolv.h, right above

Re: ld.so initarray support

2016-08-23 Thread Mark Kettenis
> Date: Mon, 22 Aug 2016 21:27:51 -0700 > From: Philip Guenther > > Right now, DT_NUM is defined in , but that's dumb: it > should be moved immediately to libexec/ld.so/resolv.h, right above this > struct, and its value increased to match the growth here. I killed it's >

Re: ld.so initarray support

2016-08-22 Thread Philip Guenther
On Mon, 22 Aug 2016, Mark Kettenis wrote: ... > +void > +_dl_run_dtors(elf_object_t *obj) > +{ > + if (obj->dyn.fini_array) { > + int num = obj->dyn.fini_arraysz / sizeof(Elf_Addr); > + int i; > + > + DL_DEB(("doing finiarray obj %p @%p: [%s]\n", > +

Re: ld.so initarray support

2016-08-22 Thread Mark Kettenis
> Date: Sun, 21 Aug 2016 16:35:21 -0700 > From: Philip Guenther > > On Fri, 19 Aug 2016, Mark Kettenis wrote: > > > From: Philip Guenther > > > Date: Thu, 18 Aug 2016 21:09:10 -0700 > > > > > > On Thursday, August 18, 2016, Mark Kettenis

Re: ld.so initarray support

2016-08-21 Thread Philip Guenther
On Fri, 19 Aug 2016, Mark Kettenis wrote: > > From: Philip Guenther > > Date: Thu, 18 Aug 2016 21:09:10 -0700 > > > > On Thursday, August 18, 2016, Mark Kettenis wrote: > > ... > > > > > > > > There is a functional change here. Our current ld.so

Re: ld.so initarray support

2016-08-19 Thread Mark Kettenis
> From: Philip Guenther > Date: Thu, 18 Aug 2016 21:09:10 -0700 > > On Thursday, August 18, 2016, Mark Kettenis wrote: > ... > > > > > > There is a functional change here. Our current ld.so doesn't run > > > > DT_INIT and DT_FINI for the main

Re: ld.so initarray support

2016-08-18 Thread Philip Guenther
On Thursday, August 18, 2016, Mark Kettenis wrote: ... > > > > There is a functional change here. Our current ld.so doesn't run > > > DT_INIT and DT_FINI for the main executable. The ELF standard is a bit > > > ambiguous about this, but Linux does run tose for the main

Re: ld.so initarray support

2016-08-18 Thread Mark Kettenis
> Date: Wed, 17 Aug 2016 12:50:54 -0700 > From: Philip Guenther > > On Wed, 17 Aug 2016, Mark Kettenis wrote: > ... > > Functions listed by DT_PREINIT_ARRAY get run immediately after ld.so has > > finished loading and relocating all shared objects. This happens only > > for

Re: ld.so initarray support

2016-08-17 Thread Philip Guenther
On Wed, 17 Aug 2016, Mark Kettenis wrote: ... > Functions listed by DT_PREINIT_ARRAY get run immediately after ld.so has > finished loading and relocating all shared objects. This happens only > for the main executable. The _dl_call_init() invocation in dlopen() needs to change too, or

ld.so initarray support

2016-08-17 Thread Mark Kettenis
The diff below adds support for DT_PREINIT_ARRAY, DT_INIT_ARRAY and DT_FINI_ARRAY to our ld.so. The idea is that these tags each point to a list of function pointers that get executed at initialization and termination time. Functions listed by DT_PREINIT_ARRAY get run immediately after ld.so has