Advice on a new port of newlib
Fri Aug 19 06:20:00 GMT 2005
Hi all, after looking at glibc and uClib, I have been pointed at
newlib which seems exactly what I'm after. What I am trying to do
is tricky, so I thought I would ask for some advice before I begin.
I've read through the available docs and the FAQ.
I want to port newlib to FMIOS to replace its minimal libc. FMIOS is a
microkernel system, which provides a set of libraries to emulate POSIX,
as it doesn't have POSIX system calls [http://wiki.ocgnet.org:8080/FMIOS/].
Other features/issues: native a.out at present, no shared libs, no
networking, no pthreads, gcc 2.7.1.
I have modified the system to support statically-linked ELF binaries.
At present, I can recompile all of userland and the kernel using
the ELF compiler on Linux or FreeBSD, including the existing libc.
Now I want to build gcc 3.4 to produce a native ELF compiler.
Before I try to recompile gcc, I thought I would improve the libc,
hence newlib. The native compiler only supports a.outs, so I want
to build newlib for FMIOS using the FreeBSD ELF compiler.
I'm going to have to create libgloss/fmios. I'm assuming that in
here I will need to place the code for the non-POSIX system calls,
plus the library code that emulates POSIX system calls. I guess
crt0.s goes here too. Does this all sound right? And what's the difference
between libgloss/<platform> and newlib/libc/sys/<platform>?
Will newlib be able to be built on FreeBSD, with FMIOS as the target?
Is there a stage in newlib compilation where a binary is created
and then executed? Do I have to treat this as cross-compilation?
How do I ensure the compilation uses the FMIOS headers and not the
FMIOS doesn't have link(2). Do I need to put an empty link() stub
in libgloss/fmios? Will this affect the compilation?
Is there anything else I should think about before starting? Any gotchas
for this situation?
Many thanks in advance for your advice,
More information about the Newlib