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]

Re: g++ and link once sections.


> But when I i compiled a couple of object files having template code  the
> resulting .o files do not have these sections . Am I missing out any
> other macros that are related to this ??

A number, including SUPPORTS_ONE_ONLY, SUPPORTS_WEAK, as well as the
setting of flag_weak. I'd really recommend to analyse this in a
debugger; set a breakpoint on supports_one_only, comdat_linkage, and
make_decl_one_only.

> Secondly I would like to know, is this a _must_  for  templates ??

No. You can make the templates static if you want. This increases code
size, of course. The only thing that might not work is block-static
variables in templates: for a specific instantiation, they should be
shared across translations units.

Regards,
Martin


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