Setting up crt0 and libs for arm-unknown-coff

Scott C. Karlin scott@CS.Princeton.EDU
Tue May 9 12:33:00 GMT 2000

I am trying to build a cross-gcc/newlib environment for an 
arm-unknown-coff target on a linux host.

I am following the Cross-GCC FAQ using GCC 2.95.2, binutils 
2.9.1, and newlib 1.8.2.  First, I run the
script.  Then I edit newlib-1.8.2/newlib/ and
comment out both ARM_RDP_MONITOR and ARM_RDI_MONITOR since
I am not using those tools.  Next, I run the build script: arm-unknown-coff.  Finally, I su-root and

The target is an ARM4 architecture StrongARM core inside an 
Intel/LevelOne IXP1200 network processor.

I am at the point where I can compile and run a program
which prints "Hello, World" over the serial line using the
UART.  I now want to get the libraries setup so that I 
can use "printf".

I know I need to create a new (or modify an old) crt0.S file. 
I also know I need to hook my UART routines into read() and 

Here are some observations which may or may not help isolate 
the remaining things I need to do:

1. The first few lines of output from the
   script are troubling:
      ./ started Mon May  8 15:38:54 EDT 2000
      ./ configure for arm-unknown-coff.
      Configuring for a i686-pc-linux-gnu host.
      *** This configuration is not supported in the following
          (Any other directories should still work fine.)
      Created "Makefile" in /home/CrossGCC/b-arm-unknown-coff

   Is this a problem?  Do I need to modify the configuration
   files so that libgloss can be made?

2. When I compile an empty main() program, I get a couple of
      $ cat main.c
      int main(void) { return 0; }
      $ arm-unknown-coff-gcc -I. -mcpu=strongarm110 -mapcs-32
        -mno-sched-prolog -fvolatile -fno-builtin -Wall
        -Wstrict-prototypes -O2 -c main.c -o main.o
      $ arm-unknown-coff-ld -o main.coff main.o -X -N
        -Ttext 00001000 -lc
      arm-unknown-coff-ld: warning: cannot find entry symbol
      _start; defaulting to 00001000
      main.o(.text+0xc):fake: undefined reference to `__gccmain'

   Where should __gccmain be resolved?  In crt0.o or a library?
   What type of object is it?  (Or, is there a way to prevent
   it from being generated if that is more appropriate?)

3. When I compile the traditional "Hello, World" program, I get
   the above errors plus a slew of undefined references:
      $ cat hw.c
      #include <stdio.h>
      int main(void) { printf("Hello, World\n"); return 0; }

      $ arm-unknown-coff-gcc -I. -mcpu=strongarm110 -mapcs-32
        -mno-sched-prolog -fvolatile -fno-builtin -Wall
        -Wstrict-prototypes -O2 -c hw.c -o hw.o
      $ arm-unknown-coff-ld -o hw2.coff hw2.o -X -N
        -Ttext 00001000 -lc
      arm-unknown-coff-ld: warning: cannot find entry symbol
      _start; defaulting to 00001000
      In function `vfprintf_r': /home/CrossGCC/b-arm-unknown-coff/
      libc/stdio/vfprintf.c:565: undefined reference to `__ltdf2'
      undefined reference to `__umodsi3'
      undefined reference to `__udivsi3'
      [...remainder deleted...]

   This looks like it is related the common difficulty addressed in
   the CrossGCC FAQ:
   While I can stub out system library calls, I'll still need to
   provide real versions of __ltdf2, __umodsi3, __udivsi3, ...
   I assume these routines are either in newlib (which may have been
   built incorrectly), or in libgloss (which didn't get built).

I know I have some more work to do before everything works,
what is my next step?


Scott C. Karlin                             Princeton University
Graduate Student                            Department of Computer Science
Voice: (609) 258-5386                       35 Olden Street
Email:               Princeton, NJ 08544-2087

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list