|
With an ELF compiler ("What's All This about ELF? glibc?"), the most common cause of large executables is the lack of an appropriate .so library link for one of the libraries you're using. There should be a link like libc.so for every library like libc.so.5.2.18.
With an a.out compiler the most common cause of large executables is the -g linker (compiler) flag. This produces (as well as debugging information in the output file) a program which is statically linked—one which includes a copy of the C library instead of a dynamically linked copy.
Other things worth investigating are -O and -O2, which enable optimization (check the GCC documentation), and -s (or the strip command) which strip the symbol information from the resulting binary (making debugging totally impossible).
You may wish to use -N on very small executables (less than 8K with the -N), but you shouldn't do this unless you understand its performance implications, and definitely never with daemons.
|