This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++] GCC tree linkage types


Daniel Jacobowitz <drow@mvista.com> writes:

> I've gotten the feeling that LLVM has made an unfortunate choice of
> names.  You're using at least linkonce and weak in different ways than
> GNU binutils and the existing ELF platforms use them.  Weak undefined
> means that the symbol can be missing; weak defined I can never
> precisely remember, but within one linked object they can be shadowed.

A weak undefined symbol is like an ordinary undefined symbol, except
that it is not an error if the symbol is never defined (and in that
case the symbol is implicitly defined with the value zero).

A weak defined symbol is like an ordinary defined symbol, except that
it is not an error if the symbol has another definition.  Moreover, if
there is a definition which is not weak, all references to the symbol
are resolved to the non-weak definition.

(The latter is the GNU and Solaris implementation.  Some ELF linkers,
including the first SVR4 one, actually implement slightly different
semantics: a weak defined symbol is like an ordinary defined symbol,
except that it is not an error if the symbol was defined previously;
under these semantics, a weak symbol followed by a strong symbol is a
multiple definition error.)

Ian


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