This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Constructor order help (related to PR 6482)
- From: Richard Henderson <rth at redhat dot com>
- To: Kean Johnston <jkj at sco dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 10 Apr 2003 17:29:03 -0700
- Subject: Re: Constructor order help (related to PR 6482)
- References: <00cf01c2ffbc$219591a0$03419384@shrike>
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~