[coldfire-gnu-discuss] Override printf

Nathan Sidwell nathan at codesourcery.com
Fri Jul 11 07:08:18 UTC 2008


Corrin Meyer wrote:
> What is the correct way to provide my own implementation of ‘printf’?
> 
>  
> 
> I am trying to use my own ‘printf’ which is stripped down and to avoid 
> linking in Newlib in its entirety.  I am trying to use some combination 
> of ‘-nodefaultlibs’, ‘-nostdlib’, and/or ‘-nostartfiles’ to tell the 
> linker not to link in Newlib, however, I keep getting the following 
> warnings.

> 
> It looks like this is part of the CS3 library so I am guessing that 
> Newlib is getting linked in which then makes calls to the functions 
> above and that CS3 is complaining that they don’t exist since I haven’t 
> provided them for my hardware.  Is this correct?  How can I get rid of 
> these warnings?  If Newlib is being linked in (which I think it is 
> because my final binary is MUCH bigger than before), how do I get it not 
> to link in and instead use my provided printf?

You are most likely correct that newlib is still being linked in.  You can track 
this down by using the -v option on your final link, to see how the linker is 
being invoked.  The -Wl,-Map,a.map option may also be useful to determine what 
is pulling in newlib.


nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery




More information about the coldfire-gnu-discuss mailing list