This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [patch] Remove --disable-newlib-atexit-alloc.
- From: Ralf Corsepius <ralf dot corsepius at rtems dot org>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: newlib at sourceware dot org, paul at codesourcery dot com
- Date: Thu, 06 Nov 2008 07:13:00 +0100
- Subject: Re: [patch] Remove --disable-newlib-atexit-alloc.
- References: <20081106033016.65F6C6F6219F@daisy.codesourcery.com>
On Wed, 2008-11-05 at 19:30 -0800, Kazu Hirata wrote:
> Hi,
>
> Attached is a patch to remove --disable-newlib-atexit-alloc and make
> malloc a weak symbol in the support functions for atexit.
>
> A while ago, Mark Mitchell added --disable-newlib-atexit-dynamic-alloc
> to prevent atexit from pulling malloc. This was a bit inflexible
> because once newlib was built with --disable-newlib-atexit-alloc, the
> user couldn't enable malloc without rebuilding newlib.
>
> This patch makes malloc a weak symbol in the support functions of
> atexit. This way, if malloc is available for some other reason, we
> use that. Otherwise, we don't to conserve space.
>
> OK to apply?
I am not sure, for 2 (hypothetical) reasons:
* You can't be sure weak symbols are available on a particular target.
newlib is being used for embedded targets, often using antiquated
compilers and "odd" object formats.
* The syntax you are using presumes using GCC.
I am not aware about anybody using newlib without GCC, but you never
know.
Ralf