Constructor order help (related to PR 6482)

Kean Johnston jkj@sco.com
Fri Apr 11 00:39:00 GMT 2003


Hello C++ gurus,

I am reviving the OSR5 port. g++.dg/special/conpr-2.C is
failing, and the comment in it points to PR6482, which
indicates it's a contructor order problem. I started trying
to investigate and quickly discovered an interesting mess
relating to CTORS_SECTION_ASM_OP, crtbegin, collect2 and
all sorts of other chicanery. I know little about C++ so
please forgive my ignorance in any of the following.

The UnixWare C++ compiler is pretty good, and I am sure
does The Right Thing(TM) with regards to constructor order,
and it seems to have had a lot of help from the link editor,
looking at changes made to it. The OSR5 linker is the same
as the UnixWare one (for ELF, which is all I care about)
and this is what its got.

You can specify an explicit init or fini function using the
-Binit=symbol and -Bfini=symbol arguments. We may need that.
collect2 seems to have code that supports this notion, but
I would have to make a small patch to it to allow the machine
file to construct the arg, because these args are space-
sensitive (i.e none are allowed). 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.
That seems to be the whole purpose of that section.

My questions are:
1.  Does any of this help with the actual problem (the test fail)
2.  What are the right combination of things I need to define
    in sco5.h to use any/all of this
3.  How is this solved on other platforms on the same architecture?
    Can someone point me at some header files or doc please?

Many thanks in advance for your time.

Kean



More information about the Gcc mailing list