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: Is linkonce underused?


On Tuesday, December 17, 2002, at 02:06  PM, H. J. Lu wrote:

On Tue, Dec 17, 2002 at 01:34:50PM -0800, Matt Austern wrote:
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?
GRP_COMDAT can be used for that. It is available in ELF. I'd like to
see gcc support it.
Has anyone done any preliminary design work on this?  Apple
is doing some work that's relevant to it, and we'd hate to
duplicate anyone else's effort.

			--Matt


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