Constructor order help (related to PR 6482)
Richard Henderson
rth@redhat.com
Fri Apr 11 01:21:00 GMT 2003
On Thu, Apr 10, 2003 at 04:51:39PM -0700, Kean Johnston wrote:
> It also has support for
> an array of init and fini functions (and the RTLD supports
> them too), so I guess this is how we could order constructors.
Via DT_INIT_ARRAY, I assume? Yes, this is the Ideal Solution.
Currently this is implemented for ia64-linux, but noone else.
As DT_INIT_ARRAY is supportedn by more deployed dynamic linkers,
this should be supported on more targets.
> 3. How is this solved on other platforms on the same architecture?
> Can someone point me at some header files or doc please?
This is quite messy. Most of this can be determined by examining
the ifdef mess in crtstuff.c. However, here's a case study from i386-linux:
(1) OBJECT_FORMAT_ELF defined in config/elfos.h.
(2) Neither CTOR_LIST_BEGIN nor CTORS_SECTION_ASM_OP defined,
which results in the default version of __CTOR_LIST__.
(3) INIT_SECTION_ASM_OP defined in config/elfos.h, which results in
/* Stick a call to __do_global_dtors_aux into the .fini section. */
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
It may be worth your while to look at the Irix configury,
which is also implemented via linker command line switches,
rather than magic section names.
r~
More information about the Gcc
mailing list