This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is linkonce underused?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Matt Austern <austern at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 17 Dec 2002 14:06:39 -0800
- Subject: Re: Is linkonce underused?
- References: <5F5060D0-1207-11D7-BD76-000393B2ABA2@apple.com>
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.
H.J.