From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19159 invoked by alias); 27 Jun 2006 04:22:11 -0000 Received: (qmail 19146 invoked by uid 22791); 27 Jun 2006 04:22:09 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.172) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Jun 2006 04:22:05 +0000 Received: by ug-out-1314.google.com with SMTP id c2so1224857ugf for ; Mon, 26 Jun 2006 21:22:03 -0700 (PDT) Received: by 10.78.164.13 with SMTP id m13mr2362995hue; Mon, 26 Jun 2006 21:22:03 -0700 (PDT) Received: by 10.78.97.16 with HTTP; Mon, 26 Jun 2006 21:22:03 -0700 (PDT) Message-ID: Date: Tue, 27 Jun 2006 04:22:00 -0000 From: Binesh To: gcc-help@gcc.gnu.org Subject: Qn regarding building an application of smallest size for ARM-11 using gcc MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/msg00229.txt.bz2 Hi, 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. 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) Would appreciate some help / guidance on this. In case there is another forum/ list which would better annswer these question, please fwd me to the same. Thanks! -Binesh