From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31795 invoked by alias); 15 Oct 2002 10:53:30 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 31788 invoked from network); 15 Oct 2002 10:53:29 -0000 Received: from unknown (HELO rwcrmhc52.attbi.com) (216.148.227.88) by sources.redhat.com with SMTP; 15 Oct 2002 10:53:29 -0000 Received: from stevedon ([66.31.245.176]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with SMTP id <20021015105329.KRPI11063.rwcrmhc52.attbi.com@stevedon>; Tue, 15 Oct 2002 10:53:29 +0000 From: "Steve Dondley" To: "Michiel Buddingh'" , Subject: RE: Giant executables.. what am I doing wrong? Date: Tue, 15 Oct 2002 03:53:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal In-Reply-To: <20021014234939.GA35014@stack.nl> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-SW-Source: 2002-10/txt/msg00185.txt.bz2 > I'm currently trying to write a program for a linux system with limited > memory, and as such I'd like gcc to generate small, statically linked > executables. As someone new to C, I'm a little confused by the above. According to GNU C tutorial I'm reading, using static libraries INCREASES the amount of memory used. A direct quote: "An executable created with a shared library can therefore be far smaller than one created with a static library." Of course, once the shared libraries are loaded into memory, the entire program will take up just as much memory as a statically compiled executable (I assume). My understanding is that the real memory savings come when a second program is started that uses some of the same libraries as the first program and now they can share the code. So instead of the same code occupying two locations in memory, it only occupies one location. This saves memory. I'm not saying you are wrong for wanting to use a static library, I just don't understand why and I'm trying to learn. > with the --static option, then strip it with "--strip-all" I get a > program worth 332 kB(!). This confuses me as well. I can't find any documentation about the --strip-all option in the GCC manual. (Maybe because I'm new to Linux/gcc? I did 'info gcc' and then did a search for '--strip' and 'strip' but could not find any reference to this option.) I also did a google search but that turned up nothing. How/where can I find out what this does? Thanks.