> From: Philip Guenther <guent...@gmail.com> > Date: Thu, 18 Aug 2016 21:09:10 -0700 > > On Thursday, August 18, 2016, Mark Kettenis <mark.kette...@xs4all.nl> 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 executable. > > > > And Solaris allegedly does as well. So my diff changes that. > > > > > > ld.so doesn't run them because __start() in csu does! Note that > > csu needs > to run them for static executables, and we use the > > same crt0.o for both > static and dynamic executables. I think > > you're double executing them with > this. > > > > We're not double executing because we don't create a DT_INIT entry for > > them. > > Hmm, is that a bug? Static and dynamic should ideally behave the same for > all these, no?
Ah, perhaps I wasn't clear. We don't create DT_INIT for both static and dynamic executables. You raise an interesting question though. Traditional static executables cannot have DT_INIT since they don't have a .dynamic section. But static PIE executables can have DT_INIT. So should our self-relocation code attempt to exeute it?