From 3078fb4f360e44b436bafcd9e7c51f26792e34b4 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 21 Mar 2006 00:57:34 +0000 Subject: * acconfig.h (_ATEXIT_DYNAMIC_ALLOC): Undef. * configure.in (--disable-newlib-atexit-dynamic-alloc): New option. * configure: Regenerated. * newlib.hin: Regenerated. * libc/stdlib/__atexit.c (__register_exitproc): Don't call malloc if _ATEXIT_DYNAMIC_ALLOC is undefined. * libc/stdlib/__call_atexit.c (__call_exitprocs): Don't call free if _ATEXIT_DYNAMIC_ALLOC is undefined. --- newlib/ChangeLog | 12 +++ newlib/acconfig.h | 4 + newlib/configure | 183 +++++++++++++++++++++---------------- newlib/configure.in | 15 +++ newlib/libc/stdlib/__atexit.c | 4 + newlib/libc/stdlib/__call_atexit.c | 4 + newlib/newlib.hin | 4 + 7 files changed, 146 insertions(+), 80 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index f488b9f8d..fec04f0b7 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,15 @@ +2006-03-20 Mark Mitchell + + * acconfig.h (_ATEXIT_DYNAMIC_ALLOC): Undef. + * configure.in (--disable-newlib-atexit-dynamic-alloc): New + option. + * configure: Regenerated. + * newlib.hin: Regenerated. + * libc/stdlib/__atexit.c (__register_exitproc): Don't call malloc + if _ATEXIT_DYNAMIC_ALLOC is undefined. + * libc/stdlib/__call_atexit.c (__call_exitprocs): Don't call free + if _ATEXIT_DYNAMIC_ALLOC is undefined. + 2006-03-17 Jeff Johnston * libc/sys/linux/linuxthreads/config.h: Remove definition diff --git a/newlib/acconfig.h b/newlib/acconfig.h index 033951c21..86f484ec4 100644 --- a/newlib/acconfig.h +++ b/newlib/acconfig.h @@ -34,6 +34,10 @@ * sections. */ #undef HAVE_INITFINI_ARRAY +/* True if atexit() may dynamically allocate space for cleanup + functions. */ +#undef _ATEXIT_DYNAMIC_ALLOC + /* Define if the compiler supports aliasing an array to an address. */ #undef _HAVE_ARRAY_ALIASING @BOTTOM@ diff --git a/newlib/configure b/newlib/configure index a6edfef37..ce9246a31 100755 --- a/newlib/configure +++ b/newlib/configure @@ -27,6 +27,8 @@ ac_help="$ac_help --enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in" ac_help="$ac_help --enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv" +ac_help="$ac_help + --disable-newlib-atexit-alloc disable dynamic allocation of atexit entries" ac_help="$ac_help --enable-multilib build many library versions (default)" ac_help="$ac_help @@ -692,6 +694,20 @@ else newlib_iconv_external_ccs=${newlib_iconv_external_ccs} fi +# Check whether --enable-newlib-atexit-dynamic-alloc or --disable-newlib-atexit-dynamic-alloc was given. +if test "${enable_newlib_atexit_dynamic_alloc+set}" = set; then + enableval="$enable_newlib_atexit_dynamic_alloc" + if test "${newlib_atexit_dynamic_alloc+set}" != set; then + case "${enableval}" in + yes) newlib_atexit_dynamic_alloc=yes ;; + no) newlib_atexit_dynamic_alloc=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-atexit-dynamic-alloc option" 1>&2; exit 1; } ;; + esac + fi +else + newlib_atexit_dynamic_alloc=yes +fi + am__api_version="1.4" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -705,7 +721,7 @@ am__api_version="1.4" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:709: checking for a BSD compatible install" >&5 +echo "configure:725: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -758,7 +774,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:762: checking whether build environment is sane" >&5 +echo "configure:778: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -815,7 +831,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:819: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:835: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -848,12 +864,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:852: checking for Cygwin environment" >&5 +echo "configure:868: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -881,19 +897,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:885: checking for mingw32 environment" >&5 +echo "configure:901: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1063,7 +1079,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1067: checking host system type" >&5 +echo "configure:1083: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1084,7 +1100,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1088: checking target system type" >&5 +echo "configure:1104: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1102,7 +1118,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1106: checking build system type" >&5 +echo "configure:1122: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1138,7 +1154,7 @@ fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6 -echo "configure:1142: checking for working aclocal-${am__api_version}" >&5 +echo "configure:1158: checking for working aclocal-${am__api_version}" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1151,7 +1167,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1155: checking for working autoconf" >&5 +echo "configure:1171: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1164,7 +1180,7 @@ else fi echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 -echo "configure:1168: checking for working automake-${am__api_version}" >&5 +echo "configure:1184: checking for working automake-${am__api_version}" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1177,7 +1193,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1181: checking for working autoheader" >&5 +echo "configure:1197: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1190,7 +1206,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1194: checking for working makeinfo" >&5 +echo "configure:1210: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1215,7 +1231,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1219: checking for $ac_word" >&5 +echo "configure:1235: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1245,7 +1261,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1249: checking for $ac_word" >&5 +echo "configure:1265: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1294,7 +1310,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1298: checking whether we are using GNU C" >&5 +echo "configure:1314: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1303,7 +1319,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1318,7 +1334,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1322: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1338: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1349,7 +1365,7 @@ fi # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1353: checking for $ac_word" >&5 +echo "configure:1369: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1381,7 +1397,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1385: checking for $ac_word" >&5 +echo "configure:1401: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1413,7 +1429,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1417: checking for $ac_word" >&5 +echo "configure:1433: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1445,7 +1461,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1449: checking for $ac_word" >&5 +echo "configure:1465: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1490,7 +1506,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1494: checking for a BSD compatible install" >&5 +echo "configure:1510: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1547,7 +1563,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_given_INSTALL=$INSTALL echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1551: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:1567: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -1581,7 +1597,7 @@ if false; then echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1585: checking for executable suffix" >&5 +echo "configure:1601: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1591,7 +1607,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1766,7 +1782,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1770: checking for $ac_word" >&5 +echo "configure:1786: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1796,7 +1812,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1800: checking for $ac_word" >&5 +echo "configure:1816: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1847,7 +1863,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1851: checking for $ac_word" >&5 +echo "configure:1867: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1879,7 +1895,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1899: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1890,12 +1906,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1894 "configure" +#line 1910 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1921,12 +1937,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1925: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1941: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1930: checking whether we are using GNU C" >&5 +echo "configure:1946: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1935,7 +1951,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1954,7 +1970,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1958: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1974: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1997,7 +2013,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:2001: checking for ld used by GCC" >&5 +echo "configure:2017: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -2027,10 +2043,10 @@ echo "configure:2001: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:2031: checking for GNU ld" >&5 +echo "configure:2047: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:2034: checking for non-GNU ld" >&5 +echo "configure:2050: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2065,7 +2081,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:2069: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:2085: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2082,7 +2098,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:2086: checking for $LD option to reload object files" >&5 +echo "configure:2102: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2094,7 +2110,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:2098: checking for BSD-compatible nm" >&5 +echo "configure:2114: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2132,7 +2148,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2136: checking whether ln -s works" >&5 +echo "configure:2152: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2153,7 +2169,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:2157: checking how to recognise dependant libraries" >&5 +echo "configure:2173: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2326,13 +2342,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2330: checking for object suffix" >&5 +echo "configure:2346: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -2356,7 +2372,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2360: checking for ${ac_tool_prefix}file" >&5 +echo "configure:2376: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2418,7 +2434,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2422: checking for file" >&5 +echo "configure:2438: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2489,7 +2505,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2493: checking for $ac_word" >&5 +echo "configure:2509: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2537,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2525: checking for $ac_word" >&5 +echo "configure:2541: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2556,7 +2572,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2560: checking for $ac_word" >&5 +echo "configure:2576: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2588,7 +2604,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2592: checking for $ac_word" >&5 +echo "configure:2608: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2655,8 +2671,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2659 "configure"' > conftest.$ac_ext - if { (eval echo configure:2660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2675 "configure"' > conftest.$ac_ext + if { (eval echo configure:2676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2675,7 +2691,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2693,7 +2709,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2697: checking whether the C compiler needs -belf" >&5 +echo "configure:2713: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2706,14 +2722,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2743,7 +2759,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2747: checking for $ac_word" >&5 +echo "configure:2763: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2775,7 +2791,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2779: checking for $ac_word" >&5 +echo "configure:2795: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2810,7 +2826,7 @@ fi # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2814: checking for $ac_word" >&5 +echo "configure:2830: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2842,7 +2858,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2846: checking for $ac_word" >&5 +echo "configure:2862: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2877,7 +2893,7 @@ fi # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2881: checking for $ac_word" >&5 +echo "configure:2897: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2909,7 +2925,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2913: checking for $ac_word" >&5 +echo "configure:2929: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2945,12 +2961,12 @@ fi # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6 -echo "configure:2949: checking if libtool should supply DllMain function" >&5 +echo "configure:2965: checking if libtool should supply DllMain function" >&5 if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_need_dllmain=no else @@ -2979,19 +2995,19 @@ echo "$ac_t""$lt_cv_need_dllmain" 1>&6 SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mdll" echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6 -echo "configure:2983: checking how to link DLLs" >&5 +echo "configure:2999: checking how to link DLLs" >&5 if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_dll_switch=-mdll else @@ -3100,12 +3116,12 @@ exec 5>>./config.log -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3109: checking for $ac_word" >&5 +echo "configure:3125: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3318,6 +3334,13 @@ EOF fi +if test "${newlib_atexit_dynamic_alloc}" = "yes"; then +cat >> confdefs.h <> confdefs.h <&6 -echo "configure:3426: checking for .preinit_array/.init_array/.fini_array support" >&5 +echo "configure:3449: checking for .preinit_array/.init_array/.fini_array support" >&5 if eval "test \"`echo '$''{'libc_cv_initfinit_array'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3433,7 +3456,7 @@ int foo (void) { return 1; } int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; EOF if { ac_try='${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c - -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD'; { (eval echo configure:3437: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD'; { (eval echo configure:3460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then if readelf -S conftest | grep -e INIT_ARRAY > /dev/null; then libc_cv_initfinit_array=yes @@ -3456,7 +3479,7 @@ EOF fi echo $ac_n "checking for array aliasing support""... $ac_c" 1>&6 -echo "configure:3460: checking for array aliasing support" >&5 +echo "configure:3483: checking for array aliasing support" >&5 if eval "test \"`echo '$''{'libc_cv_array_aliasing'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3465,7 +3488,7 @@ char x3 = { 'a', 'b', 'c' }; extern char y2 __attribute__((alias ("x+1"))); EOF if { ac_try='${CC} $CFLAGS $CPPFLAGS -c conftest.c - 1>&AS_MESSAGE_LOG_FD'; { (eval echo configure:3469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } + 1>&AS_MESSAGE_LOG_FD'; { (eval echo configure:3492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } then libc_cv_array_aliasing=yes else diff --git a/newlib/configure.in b/newlib/configure.in index 5374d67eb..c8dc21176 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -85,6 +85,17 @@ AC_ARG_ENABLE(newlib-iconv-external-ccs, esac fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl +dnl Support --disable-newlib-atexit-dynamic-alloc +AC_ARG_ENABLE(newlib-atexit-dynamic-alloc, +[ --disable-newlib-atexit-alloc disable dynamic allocation of atexit entries], +[if test "${newlib_atexit_dynamic_alloc+set}" != set; then + case "${enableval}" in + yes) newlib_atexit_dynamic_alloc=yes ;; + no) newlib_atexit_dynamic_alloc=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;; + esac + fi], [newlib_atexit_dynamic_alloc=yes])dnl + NEWLIB_CONFIGURE(.) dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and @@ -232,6 +243,10 @@ if test "${newlib_iconv_external_ccs}" = "yes"; then AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS) fi +if test "${newlib_atexit_dynamic_alloc}" = "yes"; then +AC_DEFINE_UNQUOTED(_ATEXIT_DYNAMIC_ALLOC) +fi + AC_DEFINE_UNQUOTED(_NEWLIB_VERSION,"$VERSION") if test "${multilib}" = "yes"; then diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index 04f494738..49eebb37e 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -35,6 +35,9 @@ _DEFUN (__register_exitproc, _GLOBAL_REENT->_atexit = p = &_GLOBAL_REENT->_atexit0; if (p->_ind >= _ATEXIT_SIZE) { +#ifndef _ATEXIT_DYNAMIC_ALLOC + return -1; +#else p = (struct _atexit *) malloc (sizeof *p); if (p == NULL) { @@ -49,6 +52,7 @@ _DEFUN (__register_exitproc, #ifndef _REENT_SMALL p->_on_exit_args._fntypes = 0; p->_on_exit_args._is_cxa = 0; +#endif #endif } diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c index cea569ff4..6fa398ae2 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -61,6 +61,9 @@ _DEFUN (__call_exitprocs, (code, d), (*((void (*)(_PTR)) fn))(args->_fnargs[n]); } +#ifndef _ATEXIT_DYNAMIC_ALLOC + break; +#else /* Move to the next block. Free empty blocks except the last one, which is part of _GLOBAL_REENT. */ if (p->_ind == 0 && p->_next) @@ -79,5 +82,6 @@ _DEFUN (__call_exitprocs, (code, d), lastp = &p->_next; p = p->_next; } +#endif } } diff --git a/newlib/newlib.hin b/newlib/newlib.hin index b716ab5b2..207192897 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -34,6 +34,10 @@ * sections. */ #undef HAVE_INITFINI_ARRAY +/* True if atexit() may dynamically allocate space for cleanup + functions. */ +#undef _ATEXIT_DYNAMIC_ALLOC + /* Define if the compiler supports aliasing an array to an address. */ #undef _HAVE_ARRAY_ALIASING /* -- cgit v1.2.3