Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!ptimtc!nntp-server.caltech.edu!madler From: madler@nntp-server.caltech.edu (Mark Adler) Newsgroups: comp.sys.next Subject: Small executables (was Re: 16mb minimum for next machines) Message-ID: <1991May1.062022.1056@nntp-server.caltech.edu> Date: 1 May 91 06:20:22 GMT References: <3381@kluge.fiu.edu> Organization: California Institute of Technology, Pasadena Lines: 28 Adrian Smith notices: >> A standard old "Hello World" in C takes 48K with no >> optimized compile switches on my slab. Nearly all of that is 48K is not necessary. The compile switches -s (to not include the symbol table info) and -object (to use the MH_OBJECT format which allows small binaries to be small) reduce the size considerably: beauty> cc -object -s hello.c beauty> ls -l a.out -rwxr-xr-x 1 me 1236 Apr 30 23:02 a.out* beauty> a.out hello, world A null program is 1140 bytes when compiled this way. The -s reduces the size from 48811 to 16384, and -object takes it from 16384 to 1236. -object doesn't seem to work with Objective-C programs though, so they have a minimum object size of 16K. -s does the same thing as strip, which you can do after the compile and load. I have used it often to make executables from ftp sites much smaller. Mark Adler madler@pooh.caltech.edu