How to port Newlib?

Jeff Johnston jjohnstn@redhat.com
Wed Jul 11 09:46:00 GMT 2007


Matthew,

   Take a look at the faq page for newlib.  Go to:

   http://sources.redhat.com/newlib

   and click the faq link.

   There is a brief section on porting newlib.

-- Jeff J.

Matthew Iselin wrote:
> I'm working on a hobby OS and want to port a simple C library so that
> I don't have to write the library myself (and so that eventually I can
> port GCC and binutils and have the OS self-hosting).
> 
> The problem is, I don't know how to port newlib... I have a file
> called syscalls.c that I wrote which has implementation outlined as
> required in the documentation (libc.info, syscalls section) - every
> function (_exit, _open, et al).
> 
> Where exactly do I put this code?
> 

libgloss

> Also, when I built the library and tried to link with a simple "Hello
> World" program (the out-of-the-box version, no changes at all) I got
> "undefined reference to `printf'"... Any ideas?
> 

add a linker script (xxxx.ld) to your libgloss package and then 
compile/link specifying -Txxxx.ld  The linker script can encapsulate all 
the libraries needed to link to (e.g. libc libm libgcc ...).  Check out 
libgloss/mn10300/ and look at sim.ld or eval.d for examples of a linker 
script.



More information about the Newlib mailing list