You might want to ask the thousands of Electron App users how much they care about dead code ;-)
I mean, you are right. But if you offer your users no alternative they might not care enough to choose another product. In addition, some might even value it not having to choose the right binary for their system.
Yes. The true innovation that made all this possible is the novel Actually Portable Executable (APE) format. This means there's no need to choose: Windows will read it as a valid PE file while Linux, the BSDs and Mac will read it as a valid ELF program.
Having code for all operating systems in the executable has always been possible. It's just that before APE there used to be no point. Windows simply isn't able to load and execute an ELF program even if there is Windows code in it.
ELFs would be incompatible even between Linux, Mac and the BSDs since they would almost always depend on very different dynamic libraries. Cosmopolitan fixes this by providing a standard C library with support for everything. I assume incompatibilities can still be introduced by linking against other libraries.
You might be right though. The author might be very good at executable hacks but they're a terrible writer. Their explanation explains nothing.
> Here's how it works:
>
> MZqFpD='
> BIOS BOOT SECTOR'
> exec 7<> $(command -v $0)
> printf '\177ELF...LINKER-ENCODED-FREEBSD-HEADER' >&7
> exec "$0" "$@"
> exec qemu-x86_64 "$0" "$@"
> exit 1
> REAL MODE...
> ELF SEGMENTS...
> OPENBSD NOTE...
> NETBSD NOTE...
> MACHO HEADERS...
> CODE AND DATA...
> ZIP DIRECTORY...
Ok well that clears it up. MZqFpD='. Of course!
Then she wrote a standard C library that detects which OS you're using at runtime and branches to the appropriate implementation, allowing the same x86_64 code to run on any supported system.
Traditionally, these system differences are resolved at build time: only the code for the target platform is included. Why would anyone want Windows-specific code in a Linux build? It's dead code... right? The new run-anywhere executable format makes that code useful.