Re: GCC not calling __main()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sep 12, 2007, at 1:59 PM, Rask Ingemann Lambertsen wrote:

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

Yes. Most ELF targets don't use __main() while e.g. all a.out targets
must (I think).

That implies they use a different init/term method, right?

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?

For ELF targets, usually gcc/config/elfos.h (which many targets include indirectly through gcc/tm.h which lives in the build directory and is set up
in gcc/config.gcc - look for arm*-*-elf and the tm_file definition).

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?

   Adding

#undef INIT_SECTION_ASM_OP

to gcc/config/arm/elf.h ought to do the trick.

Hmm. It seems that I shouldn't need to modify GCC just to get this support in there. Perhaps the default approach used by arm-elf is sufficient, and I'm just side-stepping it by having my own start.S file? I find it hard to believe that modifying GCC would be necessary just to get C++ to behave for arm-elf...

To reiterate: I don't necessarily need to call __main(), I just want my static objects to get constructed/destroyed.

TIA,
--
Rick


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux