delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/27/04:12:37

From: gunther DOT ebert AT ixos-leipzig DOT de (Gunther Ebert)
Subject: Re: Why MINGW32-EGCC compiled programs so big in size?
27 Jun 1998 04:12:37 -0700 :
Message-ID: <35938B7E.25BE.cygnus.gnu-win32@ixos-leipzig.de>
References: <000601bda052$12910be0$e616e2c2 AT andrei-i DOT akdi DOT ru>
Mime-Version: 1.0
To: "Andrey I. Iliev" <andrei-i AT akdi DOT ru>
Cc: "\"GNU-Win32\"" <gnu-win32 AT cygnus DOT com>

Hi,

The libraries that come with egcs seem to be unstripped.
Both the egcs and the gcc compiler links every executable
with at least two static libraries: crt0.o and libgcc.a.
The debugging information of these libraries would also
be included in the executable which leads to huge executables, 
unless you strip either the libraries before or the executable 
after linking.

To strip the libraries please proceed as follows:

set EGCS=c:\egcs-1.02       <i.e. your egcs installation root directory>
cd \%EGCS%\lib
strip --strip-debug *.a
cd \%EGCS%\lib\gcc-lib\i386-mingw32\egcs-2.90.27
strip --strip-debug *.a
cd \%EGCS%\i386-mingw32\lib
strip --strip-debug *.o

(Don't forget the --strip-debug option! strip would remove all
symbol information otherwise and you won't be able to 
link against the libraries!)

After linking again your executable should have nearly the same
size as the one of mingw32-gcc.

Gunther


Andrey I. Iliev wrote:
> 
> I build some program (source.cpp) using 3 different compilers.
> Here is file size of executables :
> 1) VC5                                68096
> 2) BCC 5.02                      69632
> 3) Cygnus b19                   23746
> 4) MINGW32-EGCC      176149 !!!
> 5) MINGW32-GCC           26046
> 
> Can anybody explain why  MINGW32-EGCC produce so big executable?
>  I feel it's probably because MINGW32-EGCC  link statically some libs?
> What libs and why?
> 
> All executables has been compiled with default options:
> GNU GCC: gcc -o source.exe source.cpp
> VC5: cl source.cpp
> BCC5: bcc32 source.cpp.
> 
> The program use the following headers:
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <time.h>
> #include <math.h>
> 
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".

-- 

Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig

Phone : +49 341 48503-0
Fax   : +49 341 48503-99
E-mail: mailto:gunther DOT ebert AT ixos-leipzig DOT de
www   : http://www.ixos-leipzig.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019