This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: malloc ld script requirements
- From: "Vitus Jensen" <Vitus_Jensen at gmx dot de>
- To: Bryce Schober <bryceman at dpzone dot com>
- Cc: bryceman at dpzone dot com, newlib at sources dot redhat dot com
- Date: Wed, 28 Apr 2004 19:45:21 +0200 (MEST)
- Subject: Re: malloc ld script requirements
- References: <408FDC25.3000706@dpzone.com>
> Bryce Schober wrote:
>
> > What does the memory heap (malloc, etc) need from an ld script?
Nothing...
> I ask this question here because the anwer I got on the
> binutils-list was:
>
> > That entirely depends on how your implementation of malloc works. It
> > might require you to define symbols in the linker script that it
> > can refer
> > to later to know the amount of memory available. Or your malloc
> > implementation might depend on something else in your BSP to test,
> > measure,
> > deduce or infer the amount of memory. You'll have to find out
> > what library
> > code you're using and look at how it works.
>
> I really hope that you're not going to ask me to delve into the
> source to figure this out. Can a newbie get some help?
malloc() requires you to supply a sbrk() routine which is called whenever
malloc() needs more memory. sbrk() is one of those ~17 routines you have to
implement in something called libgloss.
HOW you implement sbrk() is totally up to you. See the libgloss
subdirectory for examples. And -- sorry -- you have to delve into that
code.
Bye,
Vitus