This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Symbols which were not used, still in binary


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]