This is the mail archive of the gcc-help@gcc.gnu.org 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: GCC not calling __main()?


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


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