by andoma · 6y ago · 0 comments
test.c:
int main(int argc, char **argv) {
printf("hello world\n");
return 0;
}
Dynamic linking (glibc): $ gcc -O2 -Wl,--strip-all test.c
$ ls -sh a.out
8.0K a.out
Static linking (glibc): $ gcc -O2 --static -Wl,--strip-all test.c
$ ls -l a.out
760K a.out
Static linking (musl): $ musl-gcc --static -O2 -Wl,--strip-all test.c
$ ls -sh a.out
8.0K a.out jart@debian:~/cosmo$ make -j12 CPPFLAGS+=-DIM_FEELING_NAUGHTY MODE=tiny o/tiny/examples/hello.com
jart@debian:~/cosmo$ ls -sh o/tiny/examples/hello.com
20K o/tiny/examples/hello.com
Note: Output binary runs on Windows, Mac, and BSD too.