| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| Date: | Mon, 15 Apr 2002 11:29:55 -0400 |
| Message-Id: | <200204151529.g3FFTt805813@envy.delorie.com> |
| X-Authentication-Warning: | envy.delorie.com: dj set sender to dj AT delorie DOT com using -f |
| From: | DJ Delorie <dj AT delorie DOT com> |
| To: | djgpp AT delorie DOT com |
| In-reply-to: | <a9eqki$9s9$1@violet.singnet.com.sg> (gohyongkwang@hotmail.com) |
| Subject: | Re: Creating small-sized EXE |
| References: | <a9eqki$9s9$1 AT violet DOT singnet DOT com DOT sg> |
| Reply-To: | djgpp AT delorie DOT com |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
The FAQ has an entry on "Why are DJGPP .exe files so large?" Based on
that, I get these file sizes with gcc 3.0.4:
#include <stdio.h>
main()
{
printf("Hello World\n");
return 0;
}
> gcc hello.c
111,384 hello.exe
> strip hello.exe
51,606
> gcc -O2 hello.c
97,241
> strip hello.exe
43,926
The C library info files have an entire category for "startup functions"
that tell you how to reduce the size of your code:
#include <stdio.h>
__crt0_glob_function() { return 0; }
__crt0_load_environment_file() {}
__ctrO_setup_arguments() {}
main()
{
printf("Hello World\n");
return 0;
}
> gcc hello.c
95,089
> strip hello.exe
43,414
> gcc -O2 hello.c
80,946
> strip hello.exe
35,734
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |