3 ms·
I’d also argue > decent amount of stuff that CAN be done in _start before you run main It’s all optional. Before I found the Linux kernel’s nolibc [0], I
by oso2k 4y ago
I’d also argue
> decent amount of stuff that CAN be done in _start before you run main
It’s all optional. Before I found the Linux kernel’s nolibc [0], I wrote a minimal C runtime based on bunch of stuff I read [1]. Only thing you really need to do is align the stack (at least on x86, amd64). You don’t get argc/argv/envp but main will still work.
[0] https://github.com/torvalds/linux/tree/master/tools/include/nolibc https://github.com/torvalds/linux/tree/master/tools/include/...
[1] https://github.com/lpsantil/rt0/blob/master/src/lib/00_start.c https://github.com/lpsantil/rt0/blob/master/src/lib/00_start...
- saagarjha 4y agoGenerally this is either libc setup stuff, or things to support static initialization.