This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC not calling __main()?
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: Rick Mann <rmann at latencyzero dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 12 Sep 2007 10:57:37 +0200
- Subject: Re: GCC not calling __main()?
- References: <13D61D01-BF0C-43A0-B4B3-33A53B900B21@latencyzero.com>
On Tue, Sep 11, 2007 at 05:34:52PM -0700, Rick Mann wrote:
> I've made some progress on getting a GCC and Newlib built to support
> the PXA320. In the process, I've taken some steps that seem to be
> interfering with the "normal" operation of gcc. For instance, I have
> my own linker script, and my own start file.
>
> As I understand it, gcc automatically calls the __main() that calls
> the C++ constructor code generated by collect2 (http://gcc.gnu.org/
> onlinedocs/gccint/Collect2.html).
Not necessarily. __main() is used only on systems without support for
constructors and destructors. This is described in the manual:
http://gcc.gnu.org/onlinedocs/gccint/Initialization.html
http://gcc.gnu.org/onlinedocs/gccint/Macros-for-Initialization.html
If your target defines the INIT_SECTION_ASM_OP macro, then __main() isn't
normally used.
--
Rask Ingemann Lambertsen