Adding newlib to existing GCC, prefix?

Jeff Johnston jjohnstn@redhat.com
Thu Apr 8 06:28:00 GMT 2004


Vitus Jensen wrote:
> Hi Jeff,
> 
> 
>>Jeff Johnston wrote:
>>
>>>Vitus Jensen wrote:
>>>
>>>>>Vitus Jensen wrote:
>>>>>
>>>>>
>>>>>>I'm trying to add newlib-1.12.0 to an existing port of GCC.  That GCC
>>>>>>was produced some year ago by a collegue no longer available.  He
>>>>>>used the coldfire project (http://sca.uwaterloo.ca/coldfire/) to
>>>>>>crosscompile from Windows 2000 (cygwin B20) to our own
>>>>>>hardware/software plattform which uses Motorola
>>>>>>DragonBall and a propritary OS. The compiler itself runs fine, it's 
>>>>>>just that now I need a CRT...
> 
> 
> ...
> 
>>make install-target-newlib MAKE="<cygwin's make.exe> INSTALL=\"<cygwin's 
>>install.exe>\""
> 
> 
> I'm actually one step ahead: deleted everything, rearranged path, configure,
> make all, make install, got lib, created hw9012.ld, linked with libnosys.a.
> 
> m68k-coff-gcc -nostdlib test.c -Thw9012.ld -Wl,-Map=test.map 
> test.c: In function `sbrk':
> test.c:4: warning: return makes pointer from integer without a cast
> C:\tmp\ccXHJywX.o(.text+0x3c):test.c: undefined reference to `__main'
> \gcc-m68k\m68k-coff\lib/libc.a(exit.o): In function `exit':
> //T/C/coldfire/newlib-1.12.0/newlib/libc/stdlib/exit.c:102: undefined
> reference to `_exit'
> 
> 
> I can deal with those symbols when I modify libgloss.  This leads to the
> next question: how do I add our OS to libgloss?  For the lib I could just hack
> away in the libnosys directory, but as I probably need my own crt-hwdos.S
> anyway I could use a seperate directory.  Or better place the code into
> libgloss/m68k.  Where do I add my filenames?
> It's a complete OS with trap entries but obviously not already implemented
> *g*
> 
> Bye,
>    Vitus
> 

It makes sense to add to the libgloss/m68k directory.

If you look at the m68k directory in libgloss and the Makefile.in, you will see 
there are multiple board support packages there.  It is straightforward to add a 
new one for your board if you have the traps in place to call for the basic 
low-level system calls needed for newlib.  You can add your own crt0 file plus 
syscalls with some form of unique prefix (hw9012-) and reference everything in 
your new ld script.

-- Jeff J.



More information about the Newlib mailing list