3 ms·
Freestanding as in freestanding C. Lone passes the -ffreestanding -nostdlib flags. No external modules, libraries, functions or programs are loaded by the inter
by matheusmoreira 5mo ago
Freestanding as in freestanding C. Lone passes the -ffreestanding -nostdlib flags. No external modules, libraries, functions or programs are loaded by the interpreter.
It's true that lone doesn't run on bare metal. I chose Linux for pragmatic and philosophical reasons. I'm not sure lone would ever have printed hello world if I hadn't chosen to build on top of Linux, which is also the only kernel with a stable binary interface. No other system lets you avoid the libc.
- Someone 5mo agoOf course you’re free to make your own choices, but I find it weird to accept relying on many lines of Linux kernel code and then not wanting to reuse a relatively small number of lines of an existing malloc. The reverse (running on bare metal and tweaking an existing malloc to run on it) looks way more logical to me. > No other system lets you avoid the libc. On most OSes [1] it’s relatively easy to write a libOS that just wraps the system calls. Your only dependency would be on the mapping to syscall numbers. [1] OpenBSD is/may be (I don’t know the status of these) an exception. See https://man.openbsd.org/pinsyscalls.2 https://man.openbsd.org/pinsyscalls.2, https://lwn.net/Articles/949078/ https://lwn.net/Articles/949078/
- matheusmoreira 5mo ago> Your only dependency would be on the mapping to syscall numbers. These are unstable in every operating system other than Linux. I've written about it: https://www.matheusmoreira.com/articles/linux-system-calls https://www.matheusmoreira.com/articles/linux-system-calls Linux is the only kernel that promises stability in this area. On every other operating system, one must program against the system libraries.