weakref miscompiling libgfortran

Geoff Keating geoffk@geoffk.org
Thu Dec 29 04:49:00 GMT 2005


On 27/12/2005, at 3:36 PM, Jakub Jelinek wrote:

> On Tue, Dec 27, 2005 at 02:20:44PM -0800, Geoff Keating wrote:
>
>> I'm not sure what "just fine" definition you're using here.  I don't
>> think you can say it's been extensively tested, and I'm fairly sure I
>> can find a bunch of bugs in it.  I have already filed one as <http://
>> gcc.gnu.org/bugzilla/show_bug.cgi?id=25140>; I understand that also
>> occurs on ELF targets.  I don't believe it's been tested with IMA
>>
>
> PR25140 talks about something common to all kinds of aliases (replace
> `weakref' with `alias' or `weak, alias' and you'll get exactly the  
> same
> result), so I don't know why you make a case against weakref from it.

Well, there are two reasons:
1. Normally, with aliases, you only use one of the aliases in any  
given source file.  With weakrefs, you are supposed to be able to use  
both, in fact it would be common to do so.
2. On Darwin aliases don't work at all, so I don't care how broken  
they would have been if they did work.

> Weakrefs aren't really needed on Darwin for the purpose they have been
> added, so they could very well just be unsupported there too (if the
> target object file format doesn't support any kinds of aliases, why  
> should
> it support weakrefs?).

I think that's what I said below; the current implementation is  
really only for ELF targets.

However, the general feature *is* useful on Darwin.  We haven't yet  
hit a case where the libstdc++ headers would prefer to use a function  
defined only in a later Darwin version, and so would like to make it  
weak unless the user uses it directly, but in the future we probably  
will.  Likewise, user C++ libraries might want to do the same thing.   
So, I'd like to see this work in 4.2.  I think it actually does work  
on Darwin now in 4.2.

>> I would describe the version on the 4.1 branch as a hack that's to
>> work only for libgfortran on ELF targets, and that's OK; but that
>> version is not ready for general use.  I'd like to see such a  
>> general-
>>
>
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2410 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20051229/f41997c4/attachment.p7s>


More information about the Gcc mailing list