This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ code initialization

>>>>> "Rayiner" == Rayiner Hashem <> writes:

> I have a question about what steps are necessary to properly initialize
> C++ code compiled by GCC. I'm trying to use C++ an in OS kernel and
> can't depend on glibc running certain initialization tasks. I know that
> the functions in the .ctors and .dtors sections have to be called in
> order to run constructors for static objects, and just doing running
> those functions seems to be enough to get most C++ features working.
> However, RTTI and exception handling require more runtime support, and I
> was wondering what initialization those bits needed.

RTTI needs no initialization.  The EH initialization is done by the same
code that runs static constructors, though not via .ctors/.dtors; you
should provide crt[in].o and call _init as part of your startup sequence.

> On a related note, I've been looking around for detailed information
> about the code GCC produces, and while some aspects (like the global
> constructor mechanism) are well documented, others (like exception
> handling) are not. In particular, there is a dearth of information about
> the new C++ ABI.  While CodeSourcery's site is mildly useful, they don't
> give any information about implementation (specifically, GCC's) and have
> documentation on only parts of the ABI (exception handling on i386). I
> was wondering if there was any other documentation I was missing, or any
> blurbs on the generalities of the ABI so I at least had something to work
> from while reading the code.

The ABI document is an interface specification.  You should be able to work
from that, without specific implementation information.  If there's
something missing, please be more specific.

We should probably document our adjustments to the ia64 C++ ABI for other


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]