This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: weakref miscompiling libgfortran
On Tue, Dec 27, 2005 at 06:39:58PM -0500, Andrew Pinski wrote:
>
> On Dec 27, 2005, at 6:36 PM, Jakub Jelinek wrote:
> >It has nothing to do with libgfortran actually, libgfortran only ever
> >uses the weak pthread function aliases within libgfortran.
> >The reason why weakref attribute has been added is primarily libstdc++,
> >see PR4372, because unlike libgfortran or libobjc, libstdc++ installed
> >headers were using #pragma weak on all pthread_* functions it wanted
> >to use.
>
> But as mentioned the feature was not thought through. It has not been
> tested
> that well (or at all) with stuff like IMA or templates.
It works with templates the same way as __attribute__ ((alias ("...")))
and has no ambitions to work any better than that.
And at least the way it is used in gthr*.h, it works with IMA (the weakref
aliases have the same name in all compile units they are used in and are
never used for anything else).
Both TREE_PUBLIC and !TREE_PUBLIC on the weakref have some sense,
weakref is a static alias to external object/function, so either
you need to handle weakrefs specially in some parts of the frontends/IMA
and have TREE_PUBLIC set, or you need to special case it in middle-end
and all backends and have TREE_PUBLIC unset.
> I still support a reverting of the weakref patch as it was put way too
> late
> for 4.1 (stage 3 is not a good idea for a new feature).
Depends on if you consider it a new feature or a bug fix.
Jakub