[haiku-development] complex constructors in kernel (following #4782)

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: "Haiku Development" <haiku-development@xxxxxxxxxxxxx>
  • Date: Mon, 26 Oct 2009 18:57:58 +0100

> > Replying to [comment:20 bonefish]:
> > > > Hm, I would prefer a more clear/descriptive mechanism, like 
> > > > putting
> > > >  them into a different ELF section, and then skip them when 
> > > > calling the
> > > >  constructors.
> > > What "them" do you mean? I thought we're talking about 
> > > constructors,
> > > but then your sentence doesn't make sense.
> > It did to me ;-) When we move constructors into a separate segment, 
> > the
> > constructor calling code could ignore them, giving you the 
> > opportunity to
> > initialize them manually.
> The constructor calling code -- I assume you mean crtbegin.o, which 
> we
> don't even link against ATM -- shall ignore the constructors, so we 
> can
> invoke them manually? Sorry, I'm still at a loss.

What I meant is something like this:
static class Object sObject __attribute__ ((section ("complex.init")));

Since we have to call the constructors manually anyway at some point 
(we're already doing that in the boot loader, see src/system/boot/
platform/bios_ia32/start.c), we can as well check their section before 
doing so.

> > > Other than that, we could put the static constructors into a 
> > > separate
> > >  segment and free it after kernel initialization.
> > Yes, even though that would probably only be a few KB, Linux does 
> > that
> >  as well, btw.
> I wouldn't only put the constructors in there, but all initialization
> code. That's probably more than only a few KB.

That's what I meant, although I don't expect it to be that heavy.

> PS: Let's take further discussion to a more suitable place.

Done.

Bye,
   Axel.


Other related posts: