I recently tried to imagine how stack memory is probably dealt with inside the Linux kernel but could not come up with anything solid. I know the kernel uses its own functions for dynamic memory management but I have no idea how it manages just normal C stack memory because after all, that can be implemented with normal C and compiled with normal GCC. As far as I have it, stack memory allocation is normally dealt with by a form of libc when dealing with operating systems and even on something like AVR. As far as I have it though the Linux kernel does not depend on libc?
I am not entirely sure how stack memory management is delegated to libc in the first place though as it appears to be a built in language feature. All that I can imagine is that it is somehow generically compiled (or implemented) so that a provider can be assigned either afterwards or possibly as part of the compilation process. Could someone please shed some light on this for me?