Symbols which were not used, still in binary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux