i want smaller executable with gcc !
Here's my problem:
How should I optimize my program in RedHat 9.0 with gcc, to compile a smaller code? I've compiled a very simple program with gcc in RedHat 9.0 and the code size was 12kB. In Debian and Knoppix i've compiled it to 4kB. How should I optimize my gcc in RedHat to produce such a little code. Is there any debug info in that 12kB executable, or what? Thanx for help |
Hi thrix!
I think it's more a matter of which gcc you are using then the distribution. Still, to optimize the code, usually we use -O3, example: gcc -O3 -o helloworld helloworld.c But the executables will be about the same size |
try the -s flag to strip the binary of it's symbols, you'll be amazed how much it cuts out.
|
For squeezing ELF executables to the extreme, see:
http://www.muppetlabs.com/~breadbox/...ny/teensy.html |
Hko: thats a great link you pointed to. thanks.
|
You can also use the 'strip' command on the executable to strip out unwanted compiler flags and debugging info.
|
*cups hand around mouth: "echo .. echo" :D
|
All times are GMT -5. The time now is 09:03 PM. |