From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13691 invoked by alias); 28 Jun 2006 19:58:35 -0000 Received: (qmail 13670 invoked by uid 22791); 28 Jun 2006 19:58:35 -0000 X-Spam-Check-By: sourceware.org Received: from fmmailgate03.web.de (HELO fmmailgate03.web.de) (217.72.192.234) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 28 Jun 2006 19:58:33 +0000 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id 99DD657DB69 for ; Wed, 28 Jun 2006 21:58:30 +0200 (CEST) Received: from [84.57.12.112] (helo=[192.168.0.3]) by smtp05.web.de with asmtp (WEB.DE 4.107 #114) id 1FvgBC-0008W9-00 for gcc-help@gcc.gnu.org; Wed, 28 Jun 2006 21:58:30 +0200 Message-ID: <44A2DF65.8010704@web.de> Date: Wed, 28 Jun 2006 19:58:00 -0000 From: Steve Kreyer User-Agent: Thunderbird 1.5.0.4 (X11/20060614) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Symbols which were not used, still in binary Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Sender: steve.kreyer@web.de X-IsSubscribed: yes 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/msg00263.txt.bz2 Hi, I have a question about an optimization issue. I have compiled the follwing code with the command ''gcc file.c'' --------------------------------------------------------------- int add(int a, int b){ return a + b; } int main(){ } -------------------------------------------------------------- My question is: Why does the symbol "add" appear in the outcoming binary file? nm gives me: -------------------------------------------------------------- redwing@euklid:~ $ nm a.out | grep add 08048324 T add -------------------------------------------------------------- Neither is it used in this piece of code, nor is it compiled into an object file, so in my opinion it should be optimized away by gcc. So perhaps anybody can tell me whats wrong with my thought... Thanks in advance. Steve P.S. If this is not the right mailing list for this question, let me know :)