I think errno is thread local in most modern unix variants.
In Sortix, I just have the kernel set up the TLS for statically linked executables and just declare errno as:
__thread int errno;
That means errno is online from the very first instruction in _start in statically linked executables, without the need to parse the program file in early libc. There's no error conditions between _start and main. This is the kind of implementation quality I want to have in Sortix and part of why I develop Sortix.