http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54314
--- Comment #37 from Jan Hubicka <hubicka at ucw dot cz> 2013-03-12 13:32:15 UTC --- > > So perhaps the construction vtables should be always comdat hidden? > > Hmm? My earlier patch made them hidden, and they were already comdat. Do you > mean something else? What I see in the testcase from PR56557 is _ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd/443 (int (* std::basic_fstream<char>::_ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd [15])(...)) @0x7fa754fda3a8 Type: variable Visibility: external public visibility_specified visibility:hidden virtual artificial Aux: @0x7fa754fda410 References: _ZTISd/446 (addr)_ZNSdD1Ev/233 (addr)_ZNSdD0Ev/234 (addr)_ZTISd/446 (addr)_ZThn16_NSdD1Ev/447 (addr)_ZThn16_NSdD0Ev/448 (addr)_ZTISd/446 (addr)_ZTv0_n24_NSdD1Ev/449 (addr)_ZTv0_n24_NSdD0Ev/450 (addr) Referring: _ZTTSt13basic_fstreamIcSt11char_traitsIcEE/403 (addr)_ZTTSt13basic_fstreamIcSt11char_traitsIcEE/403 (addr)_ZTTSt13basic_fstreamIcSt11char_traitsIcEE/403 (addr) Availability: not-ready Varpool flags: initialized analyzed finalized I.e. it is not COMDAT, but I see it can not be because the class is explicitely instantiated the the vtable may refer to stuff that is hidden in libstdc++. The matching definition in fstream-inst.o is indeed COMDAT: _ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd/862 (int (* std::basic_fstream<char>::_ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd [15])(...)) @0x7fd19064ca28 Type: variable Visibility: force_output public weak comdat comdat_group:_ZTVSt13basic_fstreamIcSt11char_traitsIcEE one_only visibility_specified visibility:hidden virtual artificial Same comdat group as: _ZTTSt13basic_fstreamIcSt11char_traitsIcEE/861 Aux: @0x7fd19064ca90 References: _ZTISd/1138 (addr)_ZNSdD1Ev/722 (addr)_ZNSdD0Ev/723 (addr)_ZTISd/1138 (addr)_ZThn16_NSdD1Ev/1139 (addr)_ZThn16_NSdD0Ev/1140 (addr)_ZTISd/1138 (addr)_ZTv0_n24_NSdD1Ev/1141 (addr)_ZTv0_n24_NSdD0Ev/1142 (addr) Referring: _ZTTSt13basic_fstreamIcSt11char_traitsIcEE/861 (addr)_ZTTSt13basic_fstreamIcSt11char_traitsIcEE/861 (addr)_ZTTSt13basic_fstreamIcSt11char_traitsIcEE/861 (addr) Availability: not-ready Varpool flags: initialized analyzed finalized I assumed it to be public... So I suppose there is no way to write constructor of fstream that would not be linked into libstdc++.so but that is how it is intended to work... Honza