This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: MALLOC_PROVIDED HOWTO
- From: Alex Austin <alex dot austin at spectrumdsi dot com>
- To: Sterling Augustine <sterling at tensilica dot com>
- Cc: "newlib at sources dot redhat dot com" <newlib at sources dot redhat dot com>
- Date: Tue, 29 Jul 2008 10:11:38 -0700
- Subject: RE: MALLOC_PROVIDED HOWTO
- Accept-language: en-US
- Acceptlanguage: en-US
- References: <3463DABD7D4AA04C80638C42C9CAB55A2B68B43A5D@EXVMBX016-1.exch016.msoutlookonline.net> <1217351432.8688.382.camel@jaw.hq.tensilica.com>
Problem is, this platform does not have an MMU, and I am not the only thing running. This libc essentially will be statically linked to an event handler plugin, and the system I'm plugging into provides a malloc-like function.
Would implementing sbrk as below allow discontiguous address-space usage?
-----Original Message-----
From: Sterling Augustine [mailto:sterling@tensilica.com]
Sent: Tuesday, July 29, 2008 12:11 PM
To: Alex Austin
Subject: Re: MALLOC_PROVIDED HOWTO
It's easiest just to reimplement sbrk instead of reimplementing malloc.
Then you get the really nice, well-documented, tunable malloc that comes
with newlib.
void *sbrk(intptr_t increment)
{
return host_os_allocate(increment);
}
On Tue, 2008-07-29 at 10:02 -0700, Alex Austin wrote:
> My host OS has no sbrk(), so I need to reimplement malloc to use the host's memory routines. What all do I need to do? Where do I put my source, and what all needs to be defined?
>
> So far I did:
> ../newlib-1.16.0/newlib/configure --host=arm-elf --target=arm-elf --enable-interwork --enable-multilib CFLAGS="-fshort-enums -mapcs -mno-apcs-stack-check -msoft-float -mfpu=fpa -fdollars-in-identifiers
> -omit-frame-pointer -march=armv5te -mthumb-interwork -O0 -g3 -DMALLOC_PROVIDED"
>
> Compilation is hanging up at:
> ../../../newlib-1.16.0/newlib/libc/stdlib/mstats.c:125:34: macro "_mallopt_r" passed 3 arguments, but takes just 2
> ../../../newlib-1.16.0/newlib/libc/stdlib/mstats.c: In function `mallopt':
> ../../../newlib-1.16.0/newlib/libc/stdlib/mstats.c:125: error: `_mallopt_r' undeclared (first use in this function)
> ... (more errors) ...
>
> Thank you,
> - Alex
>