X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:reply-to:mime-version:to
	:subject:references:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=fhmhr47oaCoP9iU/
	M/NYnqihsRxgmBfjcSx7KhAz/qm/ClL3a5dJLgXmPKgYCQiIHTAezssk5KzH4dSr
	yjaoS/yW9lbZHXZSraHi0fPBvYrrFvB0bUnZZG/HZhi4GLRiMPIMSyyxZG/q34Sm
	kYxUjbs534f46jdJ1ivhs6fwTaw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:reply-to:mime-version:to
	:subject:references:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=WYyfYhO/38+o4yYti8tFmu
	hKYg8=; b=bZVTonIiNCEfIhcGvqXhwlG4vuAYGmSsXGFi7SUSTDmSY7sEwAdfO7
	w8/0j9VbQYtpa+FNJbhG7bfe05mrQ4cifAYN8eauNLrz/4nPR1HZX6B/hZ13Q2W4
	2nYBdjsb3FENFy6lyhIsQqbiMRYYvtjCWoB5AxI1YHn2Ny1YHpqCw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.1
Message-ID: <515D9460.8010905@cs.umass.edu>
Date: Thu, 04 Apr 2013 10:55:28 -0400
From: Eliot Moss <moss@cs.umass.edu>
Reply-To: moss@cs.umass.edu
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: But it is cygwin related.
References: <20130404170527.3708@binki> <20130404085538.GE25170@calimero.vinschen.de> <515D78B1.60209@farance.com>         <CA+sc5mmQ9rJ85rvDbMTvp_+vCx6CQPava5N3-8yxd9soh6zxQg@mail.gmail.com> <20130404230429.3100@binki>
In-Reply-To: <20130404230429.3100@binki>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

