Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [coldfire-gnu-discuss] Override printf


  • To: "Daniel Jacobowitz" <dan@xxxxxxxxxxxxxxxx>
  • Subject: RE: [coldfire-gnu-discuss] Override printf
  • From: "Corrin Meyer" <Corrin.Meyer@xxxxxxxxxxxxxxx>
  • Date: Fri, 11 Jul 2008 11:23:46 -0400

>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