This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: ATTRIBUTE_WEAK



> 
> > Correct me if I'm wrong, but isn't __attribute__ ((weak)) for when
> > you *define* a function, rather than reference it?
> 
> That's what I thought as well. As it turns out, it has a meaning to
> references, too. Referencing a weak symbol does not count as 'usage',
> i.e. the one-definition-rule does not apply; the symbol does not need
> to be defined at all.
> 
> Of course, this is an extension, and does not work on all object
> formats.
> 

It is the standard in the SVR4 ABI, aka ELF. We use it a lot in egcs,
see gthr-*.h and glibc.


-- 
H.J. Lu (hjl@gnu.org)