From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21670 invoked by alias); 6 May 2002 13:44:37 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21653 invoked from network); 6 May 2002 13:44:34 -0000 Received: from unknown (HELO executor.cambridge.redhat.com) (195.224.55.237) by sources.redhat.com with SMTP; 6 May 2002 13:44:34 -0000 Received: from prospero.cambridge.redhat.com (dell-paw-2.cambridge.redhat.com [195.224.55.226]) by executor.cambridge.redhat.com (Postfix) with ESMTP id DB984ABAF8; Mon, 6 May 2002 14:44:33 +0100 (BST) Received: by prospero.cambridge.redhat.com (Postfix, from userid 4046) id 046E7F7B91; Mon, 6 May 2002 14:44:32 +0100 (BST) To: Rayiner Hashem Cc: gcc@gcc.gnu.org Subject: Re: C++ code initialization References: <1020622276.404.11.camel@Phoenix.mindspring.com> From: Jason Merrill In-Reply-To: <1020622276.404.11.camel@Phoenix.mindspring.com> (Rayiner Hashem's message of "05 May 2002 14:11:16 -0400") Date: Mon, 06 May 2002 06:44:00 -0000 Message-ID: User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00389.txt.bz2 >>>>> "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 processors. Jason