http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50687
Bug #: 50687 Summary: Missing symbols with -flto -fvisibility=hidden on 4.6.x but not on 4.7.0 Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: giulio.euli...@cern.ch There seems to be a bug (or least a different behavior) when compiling: cat >test.cc <<-EOF struct bar { static void * foo(); virtual void * getFoo() const { return bar::foo();} }; EOF with: c++ -fPIC -shared -flto -fvisibility=hidden test.cc using gcc 4.6.x (both 4.6.1 release and this week 4.6.2 snapshot) compared to gcc 4.7.0 (20111001 snapshot). In the case of gcc 4.6.x I get a missing symbol: % nm a.out | grep U U _ZN3bar3fooEv while with 4.7.x I don't get it anymore (which is what I would expect). Dropping -flto fixes the behavior also for 4.6.x.