initializing eh

Mike Stump mrs@windriver.com
Thu Jan 11 11:17:00 GMT 2001


> From: Olaf Petzold <opetzold@wit.regiocom.net>
> To: gcc@gcc.gnu.org
> Date: Thu, 11 Jan 2001 10:01:19 +0100
> Cc: libstdc++@gcc.gnu.org

> I'm interested in the exception handling. I'm writing in C++ for the
> linux kernel therefore I have to bring all components with me. Some
> of the gcc code related to exceptions, rtti I have collected to a
> package. The problem is how to initlialize the eh. For global
> CTors/DTors I have to call __do_global_Xtor_aux(). This does
> initialize some of the eh as well but, it seems not to be enough. I
> can't catch exceptions. The problem is that I can't use the .init /
> .finit section of the elf format - I have to call it by hand.  What
> are the requiered functions. In the code there are some helper
> functions.  Some I can't call explicit.

> What is the way of initializing eh per hand (no elf .init section
> etc.) so I can emulate this for linux kernel?

Try and code

int b;

class A {
public:
	A() { b = 1; }
} a;

in the kernel and see if b is 1 after you are running.  If it is,
there isn't much to initialize, merely only the ordering could be
wrong.  If it is 0, then make it work.  If you add .init support to
the kernel, things should start working.  Issues will be, when do you
run ctors.  That, you will have to discusss on the kernel list, not
here.

After that is working, then you should switch the kernel over to using
init_priority and have them define all the numbers...  again,
something for the kernel list.

Also, when you get the above to work, you have to get it to work, so
that you can have 2 or more modules with this, and have them all
initialize.


More information about the Libstdc++ mailing list