PATCH: Disable dynamic allocation in atexit

Jeff Johnston jjohnstn@redhat.com
Tue Mar 21 20:06:00 GMT 2006


Mark Mitchell wrote:
> Jeff Johnston wrote:
> 
> 
>>I had meant for you to wait.  There should at least be a way to default
>>this for a platform in configure.host.  See newlib_io_pos_args for an
>>example unless you want me to do it.
> 
> 
> Here's a patch to do this.  I tested it by (temporarily) modifying
> arm*-*-* to avoid dynamic atexit by default, and verifying that newlib.h
> was generated with the correct value, both with and without that change,
> as well as by verifying that manual configuration options still worked.
> 
> If you'd like me to apply this, shout; otherwise, say the word and I'll
> revert the other patch.
> 

No reason to shout :)  Looks fine.  Please check it in.

Thanks,

-- Jeff J.

> Thanks,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 2006-03-20  Mark Mitchell  <mark@codesourcery.com>
> 
> 	* configure.host: Allow hosts to set the default
> 	newlib_atexit_dynamic_alloc value.
> 	* configure.in: Likewise.
> 	* configure: Regenerated.
> 
> Index: configure.host
> ===================================================================
> RCS file: /cvs/src/src/newlib/configure.host,v
> retrieving revision 1.78
> diff -c -5 -p -r1.78 configure.host
> *** configure.host	31 Jan 2006 19:33:56 -0000	1.78
> --- configure.host	21 Mar 2006 03:18:41 -0000
> *************** have_crt0=
> *** 61,70 ****
> --- 61,71 ----
>   use_libtool=no
>   have_sys_mach_dir=no
>   default_newlib_io_long_long=no
>   default_newlib_io_long_double=no
>   default_newlib_io_pos_args=no
> + default_newlib_atexit_dynamic_alloc=yes
>   aext=a
>   oext=o
>   
>   case "${target_optspace}:${host}" in
>     yes:*)
> *************** if [ "x${newlib_io_pos_args}" = "x" ]; t
> *** 736,743 ****
> --- 737,751 ----
>   	if [ ${default_newlib_io_pos_args} = "yes" ]; then
>   		newlib_io_pos_args="yes";
>   	fi
>   fi
>   
> + # Disable atexit dynamic allocation if requested.
> + if [ "x${newlib_atexit_dynamic_alloc}" = "x" ]; then
> + 	if [ ${default_newlib_atexit_dynamic_alloc} = "yes" ]; then
> + 		newlib_atexit_dynamic_alloc="yes"; 
> + 	fi
> + fi
> + 
>   if test -z "${have_crt0}" && test -n "${sys_dir}"; then
>     have_crt0="yes"
>   fi
> Index: configure.in
> ===================================================================
> RCS file: /cvs/src/src/newlib/configure.in,v
> retrieving revision 1.29
> diff -c -5 -p -r1.29 configure.in
> *** configure.in	21 Mar 2006 00:57:34 -0000	1.29
> --- configure.in	21 Mar 2006 03:18:41 -0000
> *************** AC_ARG_ENABLE(newlib-atexit-dynamic-allo
> *** 92,102 ****
>     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
>   dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
> --- 92,102 ----
>     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=${newlib_atexit_dynamic_alloc}])dnl
>   
>   NEWLIB_CONFIGURE(.)
>   
>   dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
>   dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first



More information about the Newlib mailing list