public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ code initialization
@ 2002-05-05 15:11 Rayiner Hashem
  2002-05-06  6:44 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Rayiner Hashem @ 2002-05-05 15:11 UTC (permalink / raw)
  To: gcc

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. 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.

Thanks in advance,
	Rayiner Hashem.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: C++ code initialization
  2002-05-05 15:11 C++ code initialization Rayiner Hashem
@ 2002-05-06  6:44 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2002-05-06  6:44 UTC (permalink / raw)
  To: Rayiner Hashem; +Cc: gcc

>>>>> "Rayiner" == Rayiner Hashem <heliosc@mindspring.com> 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
processors.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-06 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-05 15:11 C++ code initialization Rayiner Hashem
2002-05-06  6:44 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).