[coldfire-gnu-discuss] Override printf
Daniel Jacobowitz
dan at codesourcery.com
Fri Jul 11 15:11:03 UTC 2008
On Fri, Jul 11, 2008 at 11:07:23AM -0400, Corrin Meyer wrote:
> Now line main.c:17 is actually a printf and it should be calling my
> printf. Not exactly sure why it is getting labeled as a reference to
> 'puts'.
GCC automatically optimizes printf of a constant string to puts. You
can provide puts, or disable the optimization (-fno-builtin-printf
should do it, I believe).
> I have no idea what the undefined "__libc_init_array" is. Is
> this a list of initialization functions that should be run by the C
> library on start?
The startup code is partly in other places (like crt* files and
libcs3.a), but it calls into newlib. __libc_init_array is a function
that executes constructors.
I recommend you put your printf, and any other overridden functions,
in front of newlib rather than removing it. It may be that this
wasn't working for you before because of the printf -> puts optimization.
--
Daniel Jacobowitz
CodeSourcery
More information about the coldfire-gnu-discuss
mailing list