This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, Dec 01, 2003 at 09:10:26PM -0500, Peter Barada wrote: > > Is there any way to control the order of static constructors so that > some that access other functions are done after those functions > intializing fucntions are done? > > I guess I'm really asking is there any way to collect together a group > of static constructors and then have them 'constructed' *after* some > initialization functions for objects/libraries that they refer to have > been called? Peter, Don't know if you can tweak what I do, to work in your case, but here is a nuts & bolts approach, FWIW: o Use a linker command script with a nifty sequence of initialisation sections. e.g. .init0, .init1, ... init9. (The avr-gcc|binutils distro comes with 'em, so you may not even have to tweak yours, either.) o Use e.g. __attribute__ ((section(".init5"))) to place in-line constructor code between what's done at 4 and 6. o It'll all run before main. (The .finiX sections have the destructor code.) Caveat: I'm doing it in assembler, using e.g.: .section .init6,"ax",@progbits so the chance that there's something in your circumstances that I haven't thought of is a bit like the elephant hiding in a strawberry patch by painting its toenails red. ;-) Erik ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |