From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13034 invoked by alias); 15 Oct 2002 00:08:23 -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 13026 invoked from network); 15 Oct 2002 00:08:22 -0000 Received: from unknown (HELO lars.boxcarmedia.com) (209.213.0.162) by sources.redhat.com with SMTP; 15 Oct 2002 00:08:22 -0000 Received: from windows9q3yn19 (pool-151-203-145-112.wma.east.verizon.net [151.203.145.112]) by lars.boxcarmedia.com (Postfix) with SMTP id A4C7C122DC2; Mon, 14 Oct 2002 20:08:21 -0400 (EDT) Message-ID: <003d01c273de$f0768bb0$0100a8c0@windows9q3yn19> From: "Joshua Nye" To: "Michiel Buddingh'" , References: <20021014234939.GA35014@stack.nl> Subject: Re: Giant executables.. what am I doing wrong? Date: Mon, 14 Oct 2002 17:08:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002-10/txt/msg00175.txt.bz2 Are you sure you want to create a static executable? If you are trying to save memory, shared executables are probably better. With shared executables the C library will get loaded into memory once and can be used by multiple programs at the same time. Static programs will eat up more memory by loading effectively multiple copies of the C library, one for each program running. --josh ----- Original Message ----- From: "Michiel Buddingh'" To: Sent: Monday, October 14, 2002 7:49 PM Subject: Giant executables.. what am I doing wrong? > 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. > > However, if I compile even a simple program like: > > int main() { write(2,"Hello world.\n", 13); return 0; } > > with the --static option, then strip it with "--strip-all" I get a > program worth 332 kB(!). > > Needless to say, this is not exactly what I want. > > I have tried both gcc 2.95 and gcc 3.2, but the results differ only by > a few bytes. > > Am I missing something really obvious here? > -- > -- Michiel >