http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375
--- Comment #112 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-09-28 13:33:03 UTC --- OK, the problem turns out to be configure issue. Configure script greps asm output and with slim LTO it does not find there what it expects disabling hidden visibilities. No surprise this leads to a performance disaster. I use the following hack: diff -r 06b2977afb85 configure.in --- a/configure.in Fri Sep 09 23:25:02 2011 -0400 +++ b/configure.in Wed Sep 28 15:30:56 2011 +0200 @@ -3035,7 +3035,7 @@ int foo __attribute__ ((visibility ("hidden"))) = 1; EOF ac_cv_visibility_hidden=no - if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if ${CC-cc} -Werror -S -fno-lto conftest.c -o conftest.s >/dev/null 2>&1; then if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then ac_cv_visibility_hidden=yes fi @@ -3051,7 +3051,7 @@ int foo __attribute__ ((visibility ("default"))) = 1; EOF ac_cv_visibility_default=no - if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if ${CC-cc} -fvisibility=hidden -Werror -S -fno-lto conftest.c -o conftest.s >/dev/null 2>&1; then if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then ac_cv_visibility_default=yes fi @@ -3070,7 +3070,7 @@ int foo_default = 1; EOF ac_cv_visibility_pragma=no - if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then + if ${CC-cc} -Werror -S -fno-lto conftest.c -o conftest.s >/dev/null 2>&1; then if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then ac_cv_visibility_pragma=yes @@ -3092,7 +3092,7 @@ } EOF ac_cv_have_visibility_class_bug=no - if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then + if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -fno-lto -o conftest.S conftest.c > /dev/null 2>&1 ; then ac_cv_have_visibility_class_bug=yes else if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then @@ -3116,7 +3116,7 @@ } EOF ac_cv_have_visibility_builtin_bug=no - if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then + if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -fno-lto -o conftest.S conftest.c > /dev/null 2>&1 ; then ac_cv_have_visibility_builtin_bug=yes else if test `grep -c "@PLT" conftest.S` = 0; then