public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Symbols which were not used, still in binary
@ 2006-06-28 19:58 Steve Kreyer
  2006-06-28 20:17 ` Brian Dessent
  2006-06-28 20:17 ` Michael Eager
  0 siblings, 2 replies; 6+ messages in thread
From: Steve Kreyer @ 2006-06-28 19:58 UTC (permalink / raw)
  To: gcc-help

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 :)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-29  5:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 19:58 Symbols which were not used, still in binary Steve Kreyer
2006-06-28 20:17 ` Brian Dessent
2006-06-28 21:21   ` Steve Kreyer
2006-06-28 20:17 ` Michael Eager
2006-06-28 21:20   ` Brian Dessent
2006-06-29  5:16     ` Ingo Krabbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).