Using built-in specs. COLLECT_GCC=gcc45 COLLECT_LTO_WRAPPER=/pkg/gcc-4.5-091004/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/pkg/gcc-4.5-091004 --enable-checking=release --enable-languages=c,c++ --disable-nls --enable-lto Thread model: posix gcc version 4.5.0 20091004 (experimental) (GCC)
With the attached simple lto test case I would have expected f1 and f2 and y to be optimized away when built with -fwhole-program. But that was not the case. nm ./tlto ... 0000000000601020 b completed.5856 0000000000601010 W data_start 0000000000601028 b dtor_idx.5858 0000000000400560 T f1 0000000000400550 T f2 00000000004004f0 t frame_dummy 0000000000400520 T main U printf@@GLIBC_2.2.5 0000000000601030 B y -- Summary: lto does not eliminate unused variables Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andi-gcc at firstfloor dot org GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41589