From 952c7b74000865574276838db7365a76980839a0 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Fri, 13 Jan 2006 03:58:38 +0000 Subject: [PATCH] acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Enable --gc-sections in more cases. 2006-01-12 Benjamin Kosnik * acinclude.m4(GLIBCXX_CHECK_LINKER_FEATURES): Enable --gc-sections in more cases. * configure: Regenerate. * scripts/testsuite_flags.in: Remove SECTION_LDFLAGS. * scripts/testsuite_flags.in (cxxldflags): New. * testsuite/lib/libstdc++.exp (v3_target_compile): Add cxxldflags. (libstdc++_init ): Same. From-SVN: r109662 --- libstdc++-v3/ChangeLog | 13 +- libstdc++-v3/acinclude.m4 | 13 +- libstdc++-v3/configure | 530 +++++++++++++---------- libstdc++-v3/scripts/testsuite_flags.in | 7 +- libstdc++-v3/testsuite/lib/libstdc++.exp | 9 +- 5 files changed, 329 insertions(+), 243 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7e165e9bb04..995e2623595 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2006-01-12 Benjamin Kosnik + + * acinclude.m4(GLIBCXX_CHECK_LINKER_FEATURES): Enable + --gc-sections in more cases. + * configure: Regenerate. + * scripts/testsuite_flags.in: Remove SECTION_LDFLAGS. + * scripts/testsuite_flags.in (cxxldflags): New. + * testsuite/lib/libstdc++.exp (v3_target_compile): Add cxxldflags. + (libstdc++_init ): Same. + 2006-01-12 Jan Beulich * crossconfig.m4: Add AC_DEFINE-s for HAVE_HYPOT, HAVE_ISINF, and @@ -6,7 +16,8 @@ 2006-01-11 Benjamin Kosnik - * acinclude.m4: Use -Wl,-z,relro if possible. + * acinclude.m4(GLIBCXX_CHECK_LINKER_FEATURES): Use -Wl,-z,relro if + possible. * configure: Regenerate. 2006-01-10 Paolo Carlini diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 6c84ca7381f..32260f98624 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -230,7 +230,7 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -240,14 +240,9 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) - AC_TRY_RUN([ + AC_TRY_COMPILE([ int main(void) { try { throw 1; } @@ -268,7 +263,7 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 4b32f431d0c..353e04abcf7 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -8208,7 +8208,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -8218,18 +8218,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8243,29 +8235,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -8280,7 +8287,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -53047,7 +53054,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -53057,18 +53064,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -53082,29 +53081,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -53119,7 +53133,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -74379,7 +74393,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -74389,18 +74403,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -74414,29 +74420,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -74451,7 +74472,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -75874,7 +75895,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -75884,18 +75905,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -75909,29 +75922,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -75946,7 +75974,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -77245,7 +77273,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -77255,18 +77283,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -77280,29 +77300,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -77317,7 +77352,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -79403,7 +79438,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -79413,18 +79448,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -79438,29 +79465,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -79475,7 +79517,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -80727,7 +80769,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -80737,18 +80779,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -80762,29 +80796,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -80799,7 +80848,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -82100,7 +82149,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -82110,18 +82159,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -82135,29 +82176,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -82172,7 +82228,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -83865,7 +83921,7 @@ echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6 $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -83875,18 +83931,10 @@ echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6 CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -83900,29 +83948,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -83937,7 +84000,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 @@ -85951,7 +86014,7 @@ done $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'` # Set --gc-sections. - if test "$with_gnu_ld" = "notbroken"; then + if test x"$with_gnu_ld" = x"yes"; then # GNU ld it is! Joy and bunny rabbits! # All these tests are for C++; save the language and the compiler flags. @@ -85961,18 +86024,10 @@ done CFLAGS='-x c++ -Wl,--gc-sections' # Check for -Wl,--gc-sections - # XXX This test is broken at the moment, as symbols required for linking - # are now in libsupc++ (not built yet). In addition, this test has - # cored on solaris in the past. In addition, --gc-sections doesn't - # really work at the moment (keeps on discarding used sections, first - # .eh_frame and now some of the glibc sections for iconv). - # Bzzzzt. Thanks for playing, maybe next time. + # Note: It's supposed to work now, so ease off until proven wrong... echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5 echo $ECHO_N "checking for ld that supports -Wl,--gc-sections... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - ac_sectionLDflags=yes -else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -85986,29 +86041,44 @@ cat >>conftest.$ac_ext <<_ACEOF return 0; } +int +main () +{ +ac_sectionLDflags=yes + ; + return 0; +} _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_sectionLDflags=yes + ac_sectionLDflags=no else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_sectionLDflags=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_sectionLDflags=yes fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" else @@ -86023,7 +86093,7 @@ echo "${ECHO_T}$ac_sectionLDflags" >&6 fi # Set -z,relro. - # Note this is only for shared objects + # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then echo "$as_me:$LINENO: checking for ld that supports -Wl,-z,relro" >&5 diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in index 6f70002bcd4..86b02359f92 100755 --- a/libstdc++-v3/scripts/testsuite_flags.in +++ b/libstdc++-v3/scripts/testsuite_flags.in @@ -18,6 +18,7 @@ Usage: --install-cxx --cxxflags --cxxpchflags + --cxxldflags EOF } @@ -48,7 +49,7 @@ case ${query} in ;; --cxxflags) CXXFLAGS_save="-g -O2 -D_GLIBCXX_ASSERT" - CXXFLAGS_config='@SECTION_FLAGS@ @SECTION_LDFLAGS@ -fmessage-length=0 + CXXFLAGS_config='@SECTION_FLAGS@ -fmessage-length=0 @EXTRA_CXX_FLAGS@ -DLOCALEDIR="@glibcxx_localedir@" ' echo ${CXXFLAGS_save} ${CXXFLAGS_config} ;; @@ -56,6 +57,10 @@ case ${query} in PCHFLAGS="@glibcxx_PCHFLAGS@" echo ${PCHFLAGS} ;; + --cxxldflags) + SECTIONLDFLAGS="@SECTION_LDFLAGS@" + echo ${SECTIONLDFLAGS} + ;; *) print_usage ;; diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 0a76734d62b..f93dc6efc8f 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -82,7 +82,7 @@ proc libstdc++_init { testfile } { global env global v3-sharedlib global srcdir blddir objdir tool_root_dir - global cxx cxxflags + global cxx cxxflags cxxldflags global includes global gluefile wrap_flags global ld_library_path @@ -179,17 +179,20 @@ proc libstdc++_init { testfile } { } set cxx [transform "g++"] set cxxflags "-ggdb3" + set cxxldflags "" set includes "-I./" } else { # If we find a testsuite_flags file, we're testing in the build dir. if { [file exists $flags_file] } { set cxx [exec sh $flags_file --build-cxx] set cxxflags [exec sh $flags_file --cxxflags] + set cxxldflags [exec sh $flags_file --cxxldflags] set includes [exec sh $flags_file --build-includes] } else { set cxx [transform "g++"] - set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" set includes "-I${srcdir}" + set cxxldflags "" + set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" # Guess at the location of the installed locale files. # (It would be nice if "gcc --print-file-name" could find # message files, but it cannot.) @@ -321,6 +324,7 @@ proc v3_target_compile { source dest type options } { global wrap_flags global cxx global cxxflags + global cxxldflags global includes global blddir global v3-test_objs @@ -340,6 +344,7 @@ proc v3_target_compile { source dest type options } { if { $type == "executable" } { # Link the support objects into executables. set cxx_final [concat $cxx_final ${v3-test_objs}] + set cxx_final [concat $cxx_final $cxxldflags] } else { if { $type == "sharedlib" } { # Don't link in anything.