Jie Zhang wrote:
The constructors of application are placed in an array __CTOR_LIST__[]. __CTOR_LIST__[0] is the number of the destructors or -1 which means the number of the destructors are not specified. __CTOR_END__ marks the end of the array. __CTOR_END__[0] is 0. crtstuff.c sets __CTOR_LIST__[0] to -1 and __CTOR_END__[0] to 0. But elf2flt.ld.in did the same thing again, except that the symbols it provides are global. You could see two set of defined __CTOR_LIST__/__CTOR_END__ in the resulted application.

num of ctors, -1,           constructors, 0,           0
^             ^                           ^            ^
__CTOR_LIST__ __CTOR_LIST__               __CTOR_END__ __CTOR_END__

Sorry, it actually should be

num of ctors, -1,           constructors, 0,           0,
^             ^                           ^              ^
__CTOR_LIST__ __CTOR_LIST__               __CTOR_END__   __CTOR_END__

The outer pair are generated by elf2flt.ld.in. The inner pair are provided by crtstuff.c. Same is destructor array.

I discovered this when I was testing gcc-4.3, which is different with gcc-4.1 in execution of destructors.


Please review and commit it if it's OK.


Jie


_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to