[PATCH] Define _sbrk_r() even when MALLOC_PROVIDED is defined
Matt Johnson
johnso87@crhc.illinois.edu
Mon Jul 18 16:05:00 GMT 2011
Hi All,
I ran into an issue when compiling the SPEC2000 version of gcc
using my newlib-based toolchain. I define MALLOC_PROVIDED so that I can
use my own dlmalloc/nedmalloc-based implementation, but gcc still calls
sbrk(), presumably to get some idea of how much memory it used. sbrk()
unconditionally calls _sbrk_r(), which in turn calls the syscall stub
_sbrk(). The problem is that sbrk() is not left out of the library when
MALLOC_PROVIDED is defined, but _sbrk_r() *is*. So I build my libc.a,
but then gcc fails to link because of an unresolved symbol for
_sbrk_r(). My guess is that _sbrk_r() should still be defined under
MALLOC_PROVIDED so that sbrk() can use it, even if its other caller,
newlib's stock malloc, doesn't call it anymore. Attached is a patch to
make it so.
-Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newlib-sbrkr-patch.diff
Type: text/x-diff
Size: 333 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20110718/34cceeea/attachment.bin>
More information about the Newlib
mailing list