This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [patch] allow host-specific nano-malloc default



> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-
> owner@sourceware.org] On Behalf Of DJ Delorie
> Sent: Tuesday, June 10, 2014 6:50 AM
> To: newlib@sourceware.org
> Subject: [patch] allow host-specific nano-malloc default
> 
> 
> This patch makes a few minor changes to the configury to allow targets to
> default to nano-malloc instead of the usual malloc.  It also makes
nano-malloc
> the default for msp430.  Ok to apply?
> 
> 	* configure.host (default_newlib_nano_malloc): New.
> 	(msp430): Set it.
> 	* configure.in (newlib_nano_malloc): Leave unset if not set by
> 	the user.
> 	* configure: Regenerate.
> 	* libc/configure.in (NEWLIB_NANO_MALLOC): Set after running
> 	configure.host.
> 	(newlib_nano_malloc): Leave unset if not set by	the user.
> 	* libc/configure: Regenerate.
> 
> Index: configure.host
> ==========================================================
> =========
> RCS file: /cvs/src/src/newlib/configure.host,v
> retrieving revision 1.134
> diff -p -U 5 -r1.134 configure.host
> --- configure.host	4 Apr 2014 21:40:58 -0000	1.134
> +++ configure.host	9 Jun 2014 20:38:33 -0000
> @@ -69,10 +69,11 @@ have_sys_mach_dir=no
> default_newlib_io_c99_formats=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
> +default_newlib_nano_malloc=no
>  aext=a
>  oext=o
>  lpfx="lib_a-"
> 
>  case "${target_optspace}:${host}" in
> @@ -227,10 +228,11 @@ case "${host_cpu}" in
>    msp430*)
>  	newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -
> DSMALL_MEMORY"
>  	newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections
"
>  	newlib_cflags="${newlib_cflags} -mOs "
>  	machine_dir=msp430
> +	default_newlib_nano_malloc="yes"
>  	;;
>    mt*)
>  	machine_dir=mt
>  	;;
>    nds32*)
> @@ -841,10 +843,17 @@ if [ "x${newlib_atexit_dynamic_alloc}" =
>  	if [ ${default_newlib_atexit_dynamic_alloc} = "yes" ]; then
>  		newlib_atexit_dynamic_alloc="yes";
>  	fi
>  fi
> 
> +# Enable nano-malloc if requested.
> +if [ "x${newlib_nano_malloc}" = "x" ]; then
> +	if [ ${default_newlib_nano_malloc} = "yes" ]; then
> +		newlib_nano_malloc="yes";
> +	fi
> +fi
> +
>  # Remove rpc headers if xdr_dir not specified  if [ "x${xdr_dir}" = "x"
]; then
>  	noinclude="${noinclude} rpc/types.h rpc/xdr.h"
>  fi
> 
> Index: configure.in
> ==========================================================
> =========
> RCS file: /cvs/src/src/newlib/configure.in,v
> retrieving revision 1.55
> diff -p -U 5 -r1.55 configure.in
> --- configure.in	10 Dec 2013 18:57:30 -0000	1.55
> +++ configure.in	9 Jun 2014 20:38:33 -0000
> @@ -179,11 +179,11 @@ AC_ARG_ENABLE(newlib-nano-malloc,
>    case "${enableval}" in
>      yes) newlib_nano_malloc=yes ;;
>      no)  newlib_nano_malloc=no  ;;
>      *)   AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc
> option) ;;
>    esac
> - fi], [newlib_nano_malloc=no])dnl
> + fi], [newlib_nano_malloc=])dnl
> 
>  dnl Support --disable-newlib-unbuf-stream-opt  AC_ARG_ENABLE(newlib-
> unbuf-stream-opt,
>  [  --disable-newlib-unbuf-stream-opt    disable unbuffered stream
> optimization in streamio],
>  [if test "${newlib_unbuf_stream_opt+set}" != set; then
> Index: libc/configure.in
> ==========================================================
> =========
> RCS file: /cvs/src/src/newlib/libc/configure.in,v
> retrieving revision 1.24
> diff -p -U 5 -r1.24 configure.in
> --- libc/configure.in	12 Aug 2013 11:31:53 -0000	1.24
> +++ libc/configure.in	9 Jun 2014 20:38:33 -0000
> @@ -22,15 +22,16 @@ AC_ARG_ENABLE(newlib_nano_malloc,
>  [  --enable-newlib-nano-malloc    Use small-footprint nano-malloc
> implementation],
>  [case "${enableval}" in
>     yes) newlib_nano_malloc=yes ;;
>     no)  newlib_nano_malloc=no ;;
>     *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc) ;;
> - esac],[newlib_nano_malloc=no])
> -AM_CONDITIONAL(NEWLIB_NANO_MALLOC, test x$newlib_nano_malloc =
> xyes)
> + esac],[newlib_nano_malloc=])
> 
>  NEWLIB_CONFIGURE(..)
> 
> +AM_CONDITIONAL(NEWLIB_NANO_MALLOC, test x$newlib_nano_malloc
> = xyes)
> +
>  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  dnl line of the macro which fail because appropriate LDFLAGS
are
> not set.
>  _LT_DECL_SED
>  _LT_PROG_ECHO_BACKSLASH

Hi,
Though I have no right to approve, I am really glad to see it is widely
used.

Thanks,
bin




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]