global constructors

Jim Wilson wilson@specifixinc.com
Sat Feb 7 06:46:00 GMT 2004


Dave Murphy wrote:
> I'm attempting to build gcc for arm-elf & powerpc-eabi-elf targets but I'm
> having trouble with global constructors. Searching around appears to have a
> lot of conflicting information - calling __init __do_global_ctors or __main
> from crt0 before the call to main. Can anyone point me in the right
> direction with this?

There is a preferred way to do global constructors for ELF, but there is 
no one right way, and different targets do it different ways.  Asking 
for general help here probably isn't very useful.  Try asking specific 
questions.

I would expect global constructors to work for arm-elf and powerpc-eabi 
if you are using newlib/libgloss as your C library.  If you aren't using 
newlib/libgloss, then modifiy your library to do what newlib/libgloss 
do.  See in particular the crt0.S files in libgloss for arm and powerpc.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list