Greg Haerr writes:
>
>
> : I am seriously considering adding this to the kernel, but I am not clear
> : why the linker needs to be tweaked. Surely the linker just deals with the
> : data and bss segments, and leaves the stack and heap to be sorted out at
> : load time?
> :
>
> Well one reason would be that if the bss segment is placed
> above the stack segment, then the linker would have to allocate bss
> addresses differently....
>
> I think that the order could be kept the same, though,
> and not require a linker mod. That would be code, data, bss, stack, heap.
> There would be a change to the c library to use the end of the stack
> segment, rather than the end of the bss, as the beginning of heap.
>
> I still think we should discuss why this order is better than
> code, data, bss, heap, stack
>
code is in another block of memory altogether so does not really enter into
the problem, but the order I think works best is as you describe,
data, bss, stack, heap. I will have a look at the way the heap code works
and see how it works out where to start.
Al