This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
explicit template instances/vtables in named sections?
- To: egcs at cygnus dot com
- Subject: explicit template instances/vtables in named sections?
- From: Mumit Khan <khan at xraylith dot wisc dot edu>
- Date: Thu, 30 Oct 1997 10:45:31 -0600
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/