This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ -fno-weak with template instantiations
On Wed, Feb 23, 2005 at 02:33:33PM -0700, Davda, Bhavesh P (Bhavesh) wrote:
> The documentation for "-fno-weak" still states that:
>
> Do not use weak symbol support, even if it is provided by the linker.
> By default, G++ will use weak symbols if they are available. This
> option exists only for testing, and should not be used by end-users;
> it will result in inferior code and has no benefits. This option may
> be removed in a future release of G++.
>
> However, this option is indispensible when generating relocatable
> objects (ld -r) which need to have "strong" definitions of template
> class method instantiations so that they bind to the right symbols local
> to the relocatable object when finally linked into an executable.
>
> Are there any plans to remove "-fno-weak"? If so, please consider this
> case as a valuable user of this feature.
That sounds like a reason to remove it; I'm not sure quite what you're
doing, but it's far outside the normal semantics of weak and strong
symbols. You can't have two copies of a strong definition in an
executable, so binding to the "right" one is never an issue. And the
point of the mangling is that the two should be interchangeable anyway.
--
Daniel Jacobowitz
CodeSourcery, LLC