Porting Newlib: There is always a catch
Posted: Thu Dec 01, 2011 8:30 am
Hi,
I have setup multitasking, stdin/out/err interface for user-mode apps and loading and executing of elf executables. So I thought now is a good time to port newlib to my os. I have written all the system calls required by newlib in my kernel and have setup the system call handler to call the function. I have also written the other side of this newlib "essentials" which must be integrated into the newlib. I named it "syscalls.c".
Now I have been following the wiki for porting newlib. Mainly it has the "Porting Newlib" and "Os Specific Toolchain" article. After following the "Os Specific..." I managed to compile newlib after loads of errors creeping up in the form of "makeinfo missing", "i586-elf-cc" not found and finally a weird "i586-elf-ranlib" not found which I can find but make cannot. Think there is a problem with the make. Anyways corrected it after editing the makefile... Now to the point.
* I didnt compile another gcc cross compiler becoz I already had one working right now. Is it a problem?
* I got the newlib header files and the library libc.a, etc..
But how would I use it with the present compiler. please dont ask me to compile gcc. It takes loads of time to compile in this crappy system...
I tried to compile my user apps WITHOUT newlib and WITH the system call interfaces like "write" and it works perfectly.
But now I try to compile my apps with newlib header files and somehow links it with my own linker script. I already wrote one crt0.o startup script same as in the wiki. But when I compile and run it seems as if the printf doesn't get called but the rest goes on. Also once or twice I got undefined references to most of the system calls when I tried to link with libc.a ... I smell something fishy.. I havent got the clear concept here. Asking for guidance
I have setup multitasking, stdin/out/err interface for user-mode apps and loading and executing of elf executables. So I thought now is a good time to port newlib to my os. I have written all the system calls required by newlib in my kernel and have setup the system call handler to call the function. I have also written the other side of this newlib "essentials" which must be integrated into the newlib. I named it "syscalls.c".
Now I have been following the wiki for porting newlib. Mainly it has the "Porting Newlib" and "Os Specific Toolchain" article. After following the "Os Specific..." I managed to compile newlib after loads of errors creeping up in the form of "makeinfo missing", "i586-elf-cc" not found and finally a weird "i586-elf-ranlib" not found which I can find but make cannot. Think there is a problem with the make. Anyways corrected it after editing the makefile... Now to the point.
* I didnt compile another gcc cross compiler becoz I already had one working right now. Is it a problem?
* I got the newlib header files and the library libc.a, etc..
But how would I use it with the present compiler. please dont ask me to compile gcc. It takes loads of time to compile in this crappy system...
I tried to compile my user apps WITHOUT newlib and WITH the system call interfaces like "write" and it works perfectly.
But now I try to compile my apps with newlib header files and somehow links it with my own linker script. I already wrote one crt0.o startup script same as in the wiki. But when I compile and run it seems as if the printf doesn't get called but the rest goes on. Also once or twice I got undefined references to most of the system calls when I tried to link with libc.a ... I smell something fishy.. I havent got the clear concept here. Asking for guidance