f build dies with: undefined reference to `lookup_name'

David Edelsohn dje@watson.ibm.com
Thu Mar 14 18:35:00 GMT 2002


>>>>> Geoff Keating writes:

Geoff> Firstly, how do these work in C++?  In particular, if I write

Geoff> do I get foo::bar weak, ::bar weak, everything named 'bar' weak, or
Geoff> something else?  I believe the correct thing is to have foo::bar,
Geoff> only, be weak.  The current compiler seems to make 
Geoff> 'extern "C" bar' weak, which indicates (at least to me) that no-one
Geoff> thought about this at all :-).  I believe that Alan's patch will
Geoff> change this behaviour in an improving direction, but I think from the
Geoff> description it will pick ::bar, because ::bar's decl is visible at the
Geoff> point of the pragma under the name 'bar'.

	Your intuition is wrong with respect to the Solaris C Compiler
semantics for #pragma.

#pragma weak bar

makes "bar" weak.  No mangling.  If you want mangled bar weak, you need to
explicitly state the mangled string in the pragma.  If you want to define
some new, incompatible semantics for #pragma, that is fine, but I'm not
working on it.

David



More information about the Gcc-patches mailing list