RFC: weakref GCC attribute and .weakref assembly directive
Aaron W. LaFramboise
aaron98wiridge9@aaronwl.com
Tue Oct 18 19:58:00 GMT 2005
Alexandre Oliva wrote:
> On Oct 13, 2005, Daniel Jacobowitz <drow@false.org> wrote:
>
>>The difference is that ".weak sym1 = sym2" resolves to sym1 (if
>>available) else sym2; but ".weakref sym1, sym2" resolves to sym2 (if
>>available) else zero. Also sym1 does not become an external, only a
>>local alias, IIRC.
>
> Yep. In `.weak sym1 = sym2', sym1 is a weak alias, which I actually
> contrast with a weakref in the spec text I posted.
Well, that syntax is specific to the PE port as far as I know, and the
semantics don't quite match weak aliases, which I understand to be the
equivilent of:
.set sym1, sym2
.weak sym1
For instance, in PECOFF 'weak externals' (probably a rather misleading
name),
> A weak alias cannot reference an undefined symbol, weak or strong.
this statement is not true. This is because PECOFF's 'weak externals'
are actually a unique storage class, and so it can do special stuff.
But thank you guys for your help; it answers my question.
Aaron W. LaFramboise
More information about the Gcc
mailing list