This is the mail archive of the gcc-bugs@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]

Re: never-used inlines becoming statics


> Weak symbols do _not_ remove common code - they allow an alternative
> entry point for a given symbol.

In general, you're right; code associated with weak symbols is copied
into the executable.

In this specific case, you're wrong. Template instantiations as
emitted by g++ 2.8 live in linkonce ELF sections. The GNU linker (and
any other linker honoring the linkonce bit) will put only one
instantiation of a template member into the executable, dropping all
the duplicates.

So, while it may seem unfortunate that the compiler instantiates
templates that are not used, this isn't that bad with some linker
support. This linker support is currently available for ELF and
Win32 PE.

Regards,
Martin


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