--- gcc-4.3.3/libstdc++-v3/acinclude.m4.ark 2009-02-05 14:52:38.660952346 +0100 +++ gcc-4.3.3/libstdc++-v3/acinclude.m4 2009-02-05 14:57:51.317822000 +0100 @@ -251,16 +251,13 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES] # NB: This flag only works reliably after 2.16.1. Configure tests # for this are difficult, so hard wire a value that should work. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS='-Wl,--gc-sections' - - # Check for -Wl,--gc-sections - AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) - AC_TRY_LINK([ int one(void) { return 1; } - int two(void) { return 2; } - ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) - if test "$ac_gcsections" = "yes"; then + # Note that using AC_TRY_LINK is not an option because + # GCC_NO_EXECUTABLES may have been called earlier when crosscompiling. + + AC_MSG_CHECKING([for ld that supports --gc-sections]) + cxx_gc_sections=`$LD -v --help 2>/dev/null | grep "gc-sections"` + if test -n "$cxx_gc_sections"; then + ac_gcsections=yes rm -f conftest.c touch conftest.c if $CC -c conftest.c; then @@ -275,13 +272,6 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES] SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" fi AC_MSG_RESULT($ac_gcsections) - - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - else - # this is the suspicious part - CFLAGS='' - fi fi # Set -z,relro.