This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: V3 static data in classes vs AIX

>>>>> "David" == David Edelsohn <> writes:

    David> 	I just had a long discussion with the IBM compiler
    David> group about this whole situation.  I strongly advise you
    David> *not* to change comdat.

I am not talking about changing COMDAT.

    David> If I understand your proposal correctly, C++ static class members
    David> with assignments would produce an object file definition while no
    David> assignment would be changed from the current common symbol
    David> to a reference.

You don't understand correctly.  Under my proposal, C++ *template*
static data members would *never* result in a definition *unless*
explicitly instantiated.

I'm proposing is that we not define *any* template static data
members.  We already do not define ones that are explicitly
initialized -- but we try to be clever and do define (using COMMON)
variables that are defined, but not explicitly initialized.

Even if it does not fix your problem, the change I'm suggesting
*cannot* make the compiler more broken.  On AIX, we tell people that
they must explicitly instantiate templates.  But, in this one case
(static data members that are not explicitly initialized), we try to
let them get away without explicitly instantiating the templates.  We
do this by using COMMON.  From your description of AIX linker
semantics, this doesn't do what we hope, in that it doesn't result in
merging all the definitions.

So, why be simultaneously broken and inconsistent?  We should just not
define these variables at all, and make people explicitly instantiate
them too, just like we already do for everything else.

Please test my patch and let me know if it works.

If it does not, please continue to try to produce a small test-case
that causes the bad behavior.

Please do not go down some rathole of alternative AIX linker
semantics.  All that you are seeing here is the same old problem: we
depend too heavily on support for weak symbols and AIX doesn't have
them.  We can't fix the compiler at this late date, except to conform
to the model we have already adopted for AIX: explicitly instantiate
everything, and implicitly instantiate nothing.

Mark Mitchell         
CodeSourcery, LLC     

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]