Question about _init, _fini

gregory.menke at gsfc.nasa.gov gregory.menke at gsfc.nasa.gov
Fri Aug 22 11:53:45 UTC 2003


Oh yeah, I forgot about those.  Examine the bsp_specs files located in
the two bsp directories, and add the crtbegin.o and crtend.o to your version.

Gregm


Bill Gatliff writes:
 > Mike:
 > 
 > 
 > They're part of gcc's startup and shutdown processes, defined in 
 > crtbegin.o and crtend.o.
 > 
 > They're functions; declare a do-nothing version by the same name, i.e.:
 > 
 > void _init(void)
 > {
 > }
 > 
 > .... and you should be good to go.  You could also wander around in gcc's 
 > source code and see what they do, but if I recall correctly, they aren't 
 > needed in bare-bones setups.  :^)
 > 
 > 
 > b.g.
 > 
 > 
 > mikeci at acm.org wrote:
 > 
 > >>Quite likely yes.  Look for the .init and .fini sections of a linker
 > >>script for another bsp using a processor similar to yours- if you're
 > >>using a MIPS, have a look at the MongooseV's link script, you'll find it
 > >>down in the bsp directory.  WHile you're at it, you might want to check
 > >>the other sections too, linker scripts evolve and sometimes
 > >>leave bsp's behind.
 > >>
 > >>Gregm
 > >>    
 > >>
 > >
 > >Hi!
 > >
 > >Here is what I tried:
 > >
 > >1. Add a new section:
 > >
 > >
 > >.init :
 > >{
 > >     KEEP (*(.init))
 > >}
 > >
 > >and similar for .fini
 > >
 > >This gives me a linker error stating that _init and _fini are undefined.
 > >If I add
 > >.init :
 > >{
 > >     PROVIDE (_init = .);
 > >     KEEP(*(.init))
 > >}
 > >
 > >linker doesn't complain, but program generates an exception. My question
 > >is where are those two symbols defined, and how to link the code which
 > >goes with it?
 > >
 > >If I check the memory map, it seams that no code is linked neither for
 > >_init nor for _fini.
 > >
 > >
 > >Regards
 > >
 > >Ivica
 > >
 > >
 > >
 > >
 > >
 > >
 > >  
 > >
 > 
 > -- 
 > Bill Gatliff
 > Professional embedded GNU training.
 > bgat at billgatliff.com
 > 
 > 
 > 
 > 




More information about the users mailing list