Hi all,
I am facing a puzzling problem related to muslc. While running some tests with the ia32 simulator (qemu), have noticed that whenever I call malloc() and I run out of memory (because my morecore buffer is too small), I am getting some kernel crash.
I have traced the issue to the place where errno is set to -ENOMEM. Referencing to errno is platform-dependent and end up calling a function that retrieve the struct pthread associated and access errno as one of the field of the struct pthread.

What is the correct process to set up a heap from the root task in such a way that we can call malloc() and correctly handle error conditions through errno?

I am pretty sure I am doing something wrong in my initialization code (I have based my main(0 on the code from the tutorials), because I am also having other problems with malloc(). (even after I increase my heap area). 
For example, in some cases a call to malloc() end up calling a cascade of functions that eventually (from inside muslc) end up calling again malloc(). As consequence it enters in an infinite loop that stop only after it exhaust the initial stack.

I could not find any clear example that show how to correctly set up a system to use muslc.

Can anyone point me to a good example that shows how to bootstrap a system for the 5.2.0 branch?

Regards,
Fabrizio Bertocci
Real-Time Innovations, Inc.
Sunnyvale, CA