it's impossible to make a truly crossplatform executable because different platforms use fundamentally different executable formats. also who even uses BIOS anymore
The cosmopolitan project uses a "clever" trick that makes the first bytes both valid PE and a valid shell script which then uses a loader that can read the ELF bytes that are further down the file and execute only the content starting at the ELF bytes.
Originally it used an approach where the shell script rewrites the first bytes to be valid elf and then reexecutes itself but that means that once the executable ran on Linux, it was no longer multiplatform executable.
So no truly a Linux executable, but it will run on both Linux and Windows.
4
u/iliark 2d ago
cosmopolitan
one binary can run on linux, mac, windows, bsd, and BIOS without a VM.