delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/04/04/10:55:59

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 AT cs DOT umass DOT edu>
Reply-To: moss AT cs DOT umass DOT 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 AT cygwin DOT com
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>
In-Reply-To: <20130404230429.3100@binki>

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

- Raw text -


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