[patch] Remove _ATEXIT_DYNAMIC_ALLOC

Paul Brook paul@codesourcery.com
Thu Aug 24 23:09:00 GMT 2006


The attached patch removes _ATEXIT_DYNAMIC_ALLOC. It is replaced by a weak 
reference to malloc/free, as suggested by Richard Earnshaw:
http://sources.redhat.com/ml/newlib/2006/msg00207.html

This means the same library can be used for both large and small applications. 
Applications that already use malloc get the full dynamic atexit 
implementation (it's almost free anyway), whereas applications that don't use 
malloc are limited to 32 atexit slots, but don't pull in the malloc code.

The theory is that any application big enough to need more atexit slots 
probably uses malloc. The main heavy user of atexit slots is c++ (via 
__cxa_atexit), and an empty c++ program already pulls in malloc.

Ok?

Paul

2006-08-24  Paul Brook  <paul@codesourcery.com>

	* acconfig.h (_ATEXIT_DYNAMIC_ALLOC): Remove.
	* configure.in: Remove --disable-newlib-atexit-dynamic-alloc.
	* libc/stdlib/__atexit.c (__register_exitproc): Use weak reference to
	malloc.  Only allocate dynamically if it is present.
	* libc/stdlib/__call_atexit.c (__call_exitprocs): Use weak reference
	to free.
	* configure: Regenerate.
	* newlib.hin: Regenerate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.newlib_atexit
Type: text/x-diff
Size: 7207 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20060824/9c1bf12d/attachment.bin>


More information about the Newlib mailing list