GCC not calling __main()?

Rick Mann rmann@latencyzero.com
Wed Sep 12 18:24:00 GMT 2007


On Sep 12, 2007, at 1:57 AM, Rask Ingemann Lambertsen wrote:

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

Thanks for that info. If I understand it correctly, the various  
macros need to be defined when building GCC, right (not when building  
target code).

How do I determine how my target was built? I chose --target=arm-elf,  
and searching in the GCC sources for macro names like  
TARGET_ASM_NAMED_SECTION and INIT_SECTION_ASM_OP turn up nothing in  
gcc/config/arm/elf.h. Where else should I be looking?

If I need to change the configuration, how do I do that? On the  
configure line? Or do I pre-define some things when calling make?


$ arm-elf-gcc -v
Using built-in specs.
Target: arm-elf
Configured with: ../configure --prefix=/usr/local/arm3 --target=arm- 
elf --with-newlib --with-cpu=xscale --enable-languages=c,c++
Thread model: single
gcc version 4.2.1


Thanks!

-- 
Rick




More information about the Gcc-help mailing list