https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65239
Bug ID: 65239 Summary: typeinfo / VTT for some classes not visibile in shared library when LTO is used Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: jana at saout dot de I am seeing a possible issue with LTO that just seems to have appeared in GCC 5. When trying to link against the shared library "libgtkmm-2.4.so.1" from gtkmm 2.4 with -flto, I sometimes get complaints that the vtable or VTT for "Gtk::TreeViewColumn" cannot be found. In fact: nm -C .libs/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for Gtk::TreeViewColumn' 00000000002fa8c8 d VTT for Gtk::TreeViewColumn [clone .lto_priv.731] 0000000000323410 d vtable for Gtk::TreeViewColumn [clone .lto_priv.732] objdump -tC .libs/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for Gtk::TreeViewColumn' 00000000002fa8c8 l O .data.rel.ro.local 0000000000000038 .hidden VTT for Gtk::TreeViewColumn [clone .lto_priv.731] 0000000000323410 l O .data.rel.ro 00000000000000b8 .hidden vtable for Gtk::TreeViewColumn [clone .lto_priv.732] (-T comes back empty) Not using LTO everything is fine (as is LTO with 4.9.2): objdump -TC /usr/lib64/libgtkmm-2.4.so.1.1.0 | egrep '(vtable|VTT) for Gtk::TreeViewColumn' 000000319a72b7e8 w DO .data.rel.ro 0000000000000038 Base VTT for Gtk::TreeViewColumn 000000319a72b820 w DO .data.rel.ro 00000000000000b8 Base vtable for Gtk::TreeViewColumn The symbols are from here: gcc-nm -C .libs/treeviewcolumn.o | egrep '(vtable|VTT) for Gtk::TreeViewColumn' 00000000 W VTT for Gtk::TreeViewColumn 00000000 W vtable for Gtk::TreeViewColumn Note that if I create a shared library just from that single (slim LTO) object file, the vtable/VTT are there: g++ -shared -o x.so -flto -save-temps .libs/treeviewcolumn.o objdump -tC x.so | egrep '(vtable|VTT) for Gtk::TreeViewColumn' 00000000000097e0 l O .data.rel.ro 00000000000000b8 vtable for Gtk::TreeViewColumn 00000000000098b8 l O .data.rel.ro.local 0000000000000038 VTT for Gtk::TreeViewColumn If I g++ -shared -o x.so -flto -save-temps .libs/*.o (whole bunch of object files) I am getting the shared library where the vtable/VTT are missing (or rather just have hidden clones). Note that all other vtable/VTT are there, it's just the Gtk::TreeViewVolumn ones that are missing. Tested with the latest (20150226) SVN version. The .res file says: grep ZT.\*TreeViewColumnE\$ -- -lm.res 10602 218553227c96204c RESOLVED_IR _ZTTN3Gtk14TreeViewColumnE 4750 218553227c96204c RESOLVED_IR _ZTVN3Gtk14TreeViewColumnE 9268 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTIN3Gtk14TreeViewColumnE 4192 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTVN3Gtk14TreeViewColumnE 9270 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTTN3Gtk14TreeViewColumnE 9287 751c477e728966a5 PREVAILING_DEF_IRONLY_EXP _ZTSN3Gtk14TreeViewColumnE 14067 f3ebcd2e3bf3a025 RESOLVED_IR _ZTIN3Gtk14TreeViewColumnE (the shared library where the vtable/VTT aren't missing doesn't contain the RESOLVED_IR lines, just the four PREVAILING_DEF_IRONLY_EXP ones) This happens with just "-O2 -flto" on an x86_64 system. I'm not sure how to reduce the testcase or provide further information but can try to provide further information if you can tell me what you need. I've uploaded the object files here: https://www.dropbox.com/s/0rmzoxtpbdq8lc7/objectfiles.tar.gz?dl=0 ( g++ -shared -o x.so *.o )