From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5473 invoked by alias); 27 Jun 2006 08:48:33 -0000 Received: (qmail 5463 invoked by uid 22791); 27 Jun 2006 08:48:32 -0000 X-Spam-Check-By: sourceware.org Received: from mta07-winn.ispmail.ntl.com (HELO mtaout01-winn.ispmail.ntl.com) (81.103.221.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Jun 2006 08:48:27 +0000 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20060627084824.VGZT15018.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Tue, 27 Jun 2006 09:48:24 +0100 Received: from dell.littlepinkcloud.COM ([82.6.109.86]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20060627084824.STWB24467.aamtaout02-winn.ispmail.ntl.com@dell.littlepinkcloud.COM> for ; Tue, 27 Jun 2006 09:48:24 +0100 Received: from dell.littlepinkcloud.COM (localhost.localdomain [127.0.0.1]) by dell.littlepinkcloud.COM (8.13.5/8.13.5) with ESMTP id k5R8mHbe020428; Tue, 27 Jun 2006 09:48:17 +0100 Received: (from aph@localhost) by dell.littlepinkcloud.COM (8.13.5/8.13.5/Submit) id k5R8mGEA020425; Tue, 27 Jun 2006 09:48:16 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17568.61648.736880.938447@dell.pink> Date: Tue, 27 Jun 2006 08:48:00 -0000 From: Andrew Haley To: Binesh Cc: gcc-help@gcc.gnu.org Subject: Re: Qn regarding building an application of smallest size for ARM-11 using gcc In-Reply-To: <200606270817.59395.ikrabbe.ask@web.de> References: <200606270817.59395.ikrabbe.ask@web.de> X-Mailer: VM 7.19 under Emacs 21.4.1 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 X-SW-Source: 2006-06/txt/msg00232.txt.bz2 Ingo Krabbe writes: > Am Dienstag, 27. Juni 2006 06:22 schrieb Binesh: > > We are trying to build an application for ARM-11 using gcc and the > > related auto make suite) that would occupy minimal size. > > > > After adding the -Os and -mthumb we noticed that the size of the > > stripped executable with a dependency on libc.so and libz.so was about > > 87K. > > However, when we statically linked it the stripped size grew to 510 K. > > We removed all code that uses any of string library or stdio and > > instead use only system calls such as ioctl, read, write, mmap and > > munmap. (verified using the symbol dumped out by readelf) > > Despite this the size remains at 510K. Don't guess why. Try linking with -Wl,-Map,app.map This will give you a map file that tells you exactly why everything gets linked. > > Trying to link with -nostdlib fails as it refers to undefined > > reference to ioctl, read, write, mmap and munmap. > > Trying to link with -nostartfiles brought down the size to only 502K. > > > > Do the sys call routines need std libs to be linked in? > > Is there an alternative to reduce the size of the statically linked > > exe? (Assuming that it might be difficult to migrate all code to asm) Can't you just use a small asm version of those syscalls? You've got source for glibc, so writing the syscalls should only take a few hours. Andrew.