This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
printf optimiziation in gcc-3.2.x
- From: Petko Manolov <petkan at users dot sourceforge dot net>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 10 Mar 2003 13:20:00 +0200 (EET)
- Subject: printf optimiziation in gcc-3.2.x
Hi there,
I wrote my own 'printf()' for an embedded application and after compiling
it with gcc-3.2.2 i got this when i tried to link the objs:
tmp.o(.text+0x9): In function `test':
: undefined reference to `puts'
tmp.o(.text+0x18): In function `test':
: undefined reference to `putchar'
It turned out that gcc is converting 'printf' to 'puts' and 'putchar' and
later the linker can not (of course) find those symbols. I was using a
command line like:
gcc -Wall -O2 -fomit-frame-pointer -nostdinc -c tmp.c
Tried the same with gcc-2.95 and everything went OK which make me thing it
is a new "feature" in the recent versions of gcc.
Is there a way to turn off this "optimization" or whatever it is? And btw
why is this the default behavior?
thanks,
Petko