Constructor order help (related to PR 6482)

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Apr 11 21:56: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.

On 3.3 and later, we support this under hppa64-hpux.  This was
the only way that I could see to support running initializers and
finalizers in a manner that was compatible with both the HP and
GNU linkers.  This is done with a horrible set of macros and crtstuff.c.
Probably, I should write a hppa64 specific version of crtstuff but
I wanted to be sure the basics were ok.  I believe that things
run in the right order at the moment but the HP dynamic loader
runs the arrays of init and fini functions in reverse order to
ELF spec.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)



More information about the Gcc mailing list