> a static compiled and linked "hello world" in C on Linux is around ~785KB
Huh?
$ musl-gcc -xc -static -Wl,-z,norelro -Wl,-z,nosectionheader -Wl,-z,noseparate-code -s - <<eof
#include <stdio.h>
int
main(void) {
static const char s[] = "Hello, World!\n";
fwrite(s, (sizeof s)-1, 1, stdout);
}
eof
$ ./a.out
Hello, World!
$ ls -l a.out
-rwxr-xr-x 1 oguz oguz 4976 Jan 12 09:38 a.out
And if that's not enough $ musl-gcc -xc -static -nostdlib -fcf-protection=none -fno-asynchronous-unwind-tables -fomit-frame-pointer -Wl,-z,norelro -Wl,-z,nosectionheader -Wl,-z,noseparate-code -s - -lc <<eof
#include <unistd.h>
void
_start(void) {
static const char s[] = "Hello, World!\n";
write(1, s, (sizeof s)-1);
_exit(0);
}
eof
$ ./a.out
Hello, World!
$ ls -l a.out
-rwxr-xr-x 1 oguz oguz 487 Jan 12 09:58 a.out