This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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++ template instantiation aliasing problem


On Mon, 2002-02-04 at 21:17, Geoff Keating wrote:
> > From: "Stephen D. Holland" <sdh4@tam.cornell.edu>
> > To solve this, the linker should
> >   -- Issue a warning when multiply defined symbols do not map to
> > identical code
> 
> The problem with this is that often they don't map to identical code
> even though they behave the same way, because (for instance) they
> are compiled with different optimisation options.
Absolutely true. The warning message would have to be very carefully
worded, because as you say, there are innocent situations in which this
can come up. In fact, it might be the best option to only follow my
second suggestion
> > -- (possibly) maintain multiple distinct versions in the generated
> >    binary
except that the entire rest of the world has this problem also. Silently
fixing it would lead to code that only works when linked with GNU ld,
and fails mysteriously with other linkers. 

I have verified that the linkers included with SGI CC and MSVC 6.0 also
exhibit this behavior and do not generate any warnings. 

Given the subtlety of the problem, diagnosing it is important. 
how about: 

Warning: Different template instantiations for doprint(A) in foo.o,
bar.o. Try recompiling with identical debug/optimization options. 

	Steve





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