[coldfire-gnu-discuss] Override printf
Corrin Meyer
Corrin.Meyer at dornerworks.com
Fri Jul 11 15:23:46 UTC 2008
>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).
>
>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
Adding '-fno-builtin-printf' seems to have solved my problems. The
built binary is much smaller; on the order of what I expected. Since it
seems that Newlib is not being linked in, I have to assume that my C
library replacement is being placed in front of it even though I am not
sure how to explicitly say so. Is there a way to guarantee that this
will always be the case?
Corrin Meyer
More information about the coldfire-gnu-discuss
mailing list