From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mumit Khan To: egcs@cygnus.com Subject: explicit template instances/vtables in named sections? Date: Thu, 30 Oct 1997 08:45:00 -0000 Message-id: <9710301645.AA07450@modi.xraylith.wisc.edu> X-SW-Source: 1997-10/msg01247.html For targets that support named/arbitrary sections, is there any way I can tell g++ to create the code due explicit template instantiations in named sections? Same for vtables. The reason I may want to do this is the following: on cygwin32 target, g++ creates implicitly defined template code in named sections (eg., .text$xyz, where xyz stands for the mangled name), marks the section linkonce and makes symbols in these sections global. The PE linker is smart enough to basically pick one of these and throw away the rest. In a sense, these sections are "weak", but not the symbols themselves. Now comes an explicit template instantiation, a template that has already been defined in a named section in a different translation unit. This new instance is not created in a named section and linker now barfs due to multiply-defined global symbols. If this explicit instance were to be in a named section, perhaps marked to be linked once, then the PE linker should be able just pick one and it'll feel like an ELF system. Does this make any sense? Currently the template code is broken on cygwin32 target unless you apply my recently posted patch to revert to *not* using named sections, and hence lose the benefits of section discarding. Regards, Mumit -- khan@xraylith.wisc.edu http://www.xraylith.wisc.edu/~khan/