From 354b7da5e35d8b4266e484d514045a7dc1f624fb Mon Sep 17 00:00:00 2001 From: Dara Hazeghi Date: Sat, 31 Jan 2004 04:18:15 +0000 Subject: [PATCH] re PR bootstrap/9249 (bootstrap fails with --enable-__cxa-atexit on Solaris) 2004-01-30 Dara Hazeghi PR bootstrap/9249 * doc/install.texi: document --enable-__cxa_atexit option. * configure.ac: Disable __cxa_atexit if not supported. * configure: Regenerate. From-SVN: r77023 --- gcc/ChangeLog | 7 ++++ gcc/configure | 77 ++++++++++++++++++++++++++++++++++++++++++++ gcc/configure.ac | 12 ++++--- gcc/doc/install.texi | 8 +++++ 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c7792346dd..6fcea98ff80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-01-30 Dara Hazeghi + + PR bootstrap/9249 + * doc/install.texi: document --enable-__cxa_atexit option. + * configure.ac: Disable __cxa_atexit if not supported. + * configure: Regenerate. + 2003-01-30 Daniel Berlin * ggc-zone.c (ggc_free): New function. diff --git a/gcc/configure b/gcc/configure index 1c99d896b16..a1001bdaa3a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8764,11 +8764,88 @@ fi if test x$enable___cxa_atexit = xyes || \ test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then + echo "$as_me:$LINENO: checking for __cxa_atexit" >&5 +echo $ECHO_N "checking for __cxa_atexit... $ECHO_C" >&6 +if test "${ac_cv_func___cxa_atexit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char __cxa_atexit (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __cxa_atexit (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub___cxa_atexit) || defined (__stub_____cxa_atexit) +choke me +#else +char (*f) () = __cxa_atexit; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != __cxa_atexit; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_cv_func___cxa_atexit=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func___cxa_atexit=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func___cxa_atexit" >&5 +echo "${ECHO_T}$ac_cv_func___cxa_atexit" >&6 +if test $ac_cv_func___cxa_atexit = yes; then cat >>confdefs.h <<\_ACEOF #define DEFAULT_USE_CXA_ATEXIT 1 _ACEOF +else + echo "__cxa_atexit can't be enabled on this target" +fi + fi # Look for a file containing extra machine modes. diff --git a/gcc/configure.ac b/gcc/configure.ac index c29ddaa37a5..33549b0b462 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1136,11 +1136,13 @@ fi if test x$enable___cxa_atexit = xyes || \ test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then - AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1, - [Define if you want to use __cxa_atexit, rather than atexit, to - register C++ destructors for local statics and global objects. - This is essential for fully standards-compliant handling of - destructors, but requires __cxa_atexit in libc.]) + AC_CHECK_FUNC(__cxa_atexit, + [AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1, + [Define if you want to use __cxa_atexit, rather than atexit, to + register C++ destructors for local statics and global objects. + This is essential for fully standards-compliant handling of + destructors, but requires __cxa_atexit in libc.])], + echo "__cxa_atexit can't be enabled on this target") fi # Look for a file containing extra machine modes. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 6dae9c90bd8..1f53a99c715 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -939,6 +939,14 @@ option will adjust the ABI for AltiVec enhancements, as well as generate AltiVec code when appropriate. This option is only available for PowerPC systems. +@item --enable-__cxa_atexit +Define if you want to use __cxa_atexit, rather than atexit, to +register C++ destructors for local statics and global objects. +This is essential for fully standards-compliant handling of +destructors, but requires __cxa_atexit in libc. This option is currently +only available on sytems with GNU libc. When enabled, this will cause +@option{-fuse-cxa-exit} to be passed by default. + @item --enable-target-optspace Specify that target libraries should be optimized for code space instead of code speed. -- 2.30.2