Fw: Undefined references to __udivsi3 and __umodsi3 (arm-elf)

J. Johnston jjohnstn@redhat.com
Thu Oct 17 14:42:00 GMT 2002


Peter Tiang wrote:
> 
> > A little bit confused here.
> >
> > We're trying to avoid the standard system startup
> > files and library (libgcc.a), that's why we chooses
> > to use "newlib". We flagged gcc with "-nostdlib"
> > to avoid linking in of libgcc.a.
> >
> > You mean we still need libgcc.a despite of already
> > linking in newlib libraries ?
> >
> >

Yes.  The libgcc library contains C operations such as divide, mod, multiply...
(you are missing a divide and mod operator below).  Such operations require
target-specific code and sometimes are too big/complex to generate in-line so the compiler
creates functions for them and generates calls whenever C code (including newlib) uses them.  
They do not belong in the C library as they are part of supporting the
C language for the platform.

-- Jeff J.

> > >
> > >
> > > Peter Tiang wrote:
> > > >
> > > > I'm having trouble with undefined references
> > > > to __udivsi3 and __umodsi3.
> > > >
> > > > My target is arm-elf and my linker command line is
> > > >
> > > > $(LD) --gc-section -Ttext 0x01300000 -o $@ $^ $(LIBC)/crt0.o
> > $(LIBC)/libc.a
> > > > $(LIBC)/libm.a
> > > >
> > > > Anything I'm missing here ?
> > >
> > > libgcc.a?
> > >
> > > --
> > > Joel Sherrill, Ph.D.             Director of Research & Development
> > > joel@OARcorp.com                 On-Line Applications Research
> > > Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> > > Support Available                (256) 722-9985
> > >
> >



More information about the Newlib mailing list