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: Corrin Meyer <Corrin.Meyer@xxxxxxxxxxxxxxx>
  • Subject: Re: [coldfire-gnu-discuss] Override printf
  • From: Daniel Jacobowitz <dan@xxxxxxxxxxxxxxxx>
  • Date: Fri, 11 Jul 2008 11:11:03 -0400

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