This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: But it is cygwin related.
- From: Eliot Moss <moss at cs dot umass dot edu>
- To: cygwin at cygwin dot com
- Date: Thu, 04 Apr 2013 10:55:28 -0400
- Subject: Re: But it is cygwin related.
- References: <20130404170527 dot 3708 at binki> <20130404085538 dot GE25170 at calimero dot vinschen dot de> <515D78B1 dot 60209 at farance dot com> <CA+sc5mmQ9rJ85rvDbMTvp_+vCx6CQPava5N3-8yxd9soh6zxQg at mail dot gmail dot com> <20130404230429 dot 3100 at binki>
- Reply-to: moss at cs dot umass dot edu
A C program is going to want to pull in at least a C run-time
(crt0 is one common name for that link file). Consider this
minimal C program:
extern void exit(int);
void main (int argc, char **argv) {
exit(0);
}
It is 73 bytes as a .c file and 408 bytes in a .o.
It I link it, doing what gcc defaultly does, the
resulting file is 49750 bytes. (This is all under
cygwin, with gcc 4.5.3.
It *dynamically* links to:
Windows/SysWOW/ntdll.dll = 1292080 bytes
Windows/syswow64/kernel32.dll = 1114112 bytes
Windows/syswow64/KERNELBASE.dll = 274944 bytes
cygwin1.dll = 2858355 bytes
So, the program itself is small, but potentially has access
to many resources through these dlls that are shared with
other programs.
I guess I don't see what your objection is regarding size
of things, unless you feel 49750 is "too darn much". Ok,
so after I strip the program to remove symbol info needed
only when debugging, the size is 4622.
By running with gcc -v, I see it links in:
crt0.o =
crtbegin.o =
crtend.o =
and scans the C libraries for things my program, or these, call.
This includes linkage (at least) to malloc/free, etc., needed in
the startup and shutdown, I believe.
Now I add:
#include <stdio.h>
and, in main,
putchar('h');
Unstripped the size is a little bigger, 50188. Stripped
it is (guess what): 4622 bytes. ldd shows that it will
use the same dynamically linked dlls as the original.
So I'm struggling to see what it is you want / expect here.
The dlls get shared in memory between programs, and once
stripped, the programs can be quite small -- depending on
what you use. And even if you code directly to Windows
interfaces and use some other tool suite, you will end up
with the Windows dlls in any case, since that's how you
talk to the OS to get anything done.
Regards -- Eliot Moss
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple