On Wed, Sep 12, 2007 at 02:43:32PM -0700, Rick Mann wrote: > 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... I think you _are_ side-stepping it with your start.S as well as probably not using the correct linker command. > To reiterate: I don't necessarily need to call __main(), I just want > my static objects to get constructed/destroyed. Grep for __USES_INITFINI__ in libgloss/arm/crt0.S (from newlib). It registers a function _fini() with atexit() and then calls _init(). Look at gcc/config/arm/crti.asm and gcc/config/arm/crtn.asm for the first and last parts of _init() and _fini(). Assuming your GCC build produced crti.o, crtn.o, crtbegin.o and crtend.o, the linker should be able to piece it all together if with a linker command like the one from the manual (with your start.o added somewhere): http://gcc.gnu.org/onlinedocs/gccint/Initialization.html Note that there are multilib version of those four crt*.o files: $ size gcc/{*/,}crt*.o text data bss dec hex filename 164 16 32 212 d4 gcc/thumb/crtbegin.o 48 16 0 64 40 gcc/thumb/crtend.o 8 0 0 8 8 gcc/thumb/crti.o 16 0 0 16 10 gcc/thumb/crtn.o 244 16 32 292 124 gcc/crtbegin.o 68 16 0 84 54 gcc/crtend.o 24 0 0 24 18 gcc/crti.o 24 0 0 24 18 gcc/crtn.o -- Rask Ingemann Lambertsen