Is linkonce underused?
Matt Austern
austern@apple.com
Tue Dec 17 13:55:00 GMT 2002
Consider the following C++ source file:
void check(const void*);
template <class T> T* identity(T* p) { check(p); return p; }
void foo() { identity((double*) 0); }
Using the top of the 3.3 release branch to compile this
on Linus, and using the options -O0 -g -S, it's easy to
see what gets placed in which sections.
_Z8identityIdEPt_S1_ gets placed in a linkonce section,
as it ought to be. However, it's the only thing in that
linkonce section. This is puzzling, because that
template instantiation has two other parts: debug
information, and EH information. One would think that
these should all be retained or discarded as a group.
It's nice that we'll only have one copy of the actual
code for identity<double> even if it's instantiated in
a hundred translation units, but it's a shame that we'll
still get a hundred copies of the EH information and the
debug information.
Am I misunderstanding something? If not, is there some
reason we aren't using linkonce for EH and debug
information?
--Matt
More information about the Gcc
mailing list