Why does gcc add symbols to non-debug build?
Posted
by Matt Holgate
on Stack Overflow
See other posts from Stack Overflow
or by Matt Holgate
Published on 2010-03-22T09:51:50Z
Indexed on
2010/03/22
10:01 UTC
Read the original article
Hit count: 331
When I do a release build with gcc (i.e. I do not specify -g
), I still seem to end up with symbols in the binary, and have to use strip
to remove them. In fact, I can still breakpoint functions and get backtraces in gdb (albeit without line numbers).
This surprised me - can anyone explain why this happens?
e.g.
#include <stdio.h>
static void blah(void)
{
printf("hello world\n");
}
int main(int argc, char *argv[])
{
blah();
return 0;
}
gcc -o foo foo.c
nm foo | grep blah
:
08048374 t blah
© Stack Overflow or respective owner