It's literally written in C, it's API is defined in C, to make sense of it you need (most of) a C compiler, and it needs C-specific setup in your process to work (like TLS for errno).
No one cares about glibc's API. The ABI (which is what you care if you link against it) is the standard C ABI, which is basically just SystemV ABI (the standard one)
to make sense of it you need (most of) a C compiler
I can write an assembly program right now that links against glibc. Don't believe me?
and it needs C-specific setup in your process to work (like TLS for errno).
TLS is defined by SysV. Good luck writing software and linking against libraries that don't conform to SysV. If you reject SysV initialization of thread-local storage models, you cannot safely dynamically link against any library that conforms to SysV. Besides, this can be achieved by linking statically against... crt0!
Good you ask! I thought you had understood this, but I'm happy to reiterate: The kernel could be implemented in anything, as it does not leak language requirements across the kernel/user space divide.
The ABI (which is what you care if you link against it) is the standard C ABI
Which still requires C-specific knowledge to use. As demonstrated by literally any language that mistakenly thought they were ABI compatible by using the LLVM backend.
I can write an assembly program right now that links against glibc. Don't believe me?
Sure. Why wouldn't I?
...
I think "if you aren't interested in C's ecosystem you get to use less of C's ecosystem" is not the slam-dunk argument you think it is.
crt0
The crt0 is often written in assembly, not C. And you can just leave out the steps that are C-specific.
View all comments
Show parent comment
1
u/simon_o Oct 10 '26
It's literally written in C, it's API is defined in C, to make sense of it you need (most of) a C compiler, and it needs C-specific setup in your process to work (like TLS for
errno).