This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Symbols which were not used, still in binary
- From: Steve Kreyer <steve dot kreyer at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 28 Jun 2006 21:58:29 +0200
- Subject: 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 :)