I have built newlib-1.12.0 to work with a GCC ARM cross compiler. Newlib
was configured as follows on a Pentium II running
Windows:
../newlib-1.12.0/configure \
--enable-languages=c \
--target=arm-elf \
--program-prefix=arm- \
--prefix=/usr/local/arm
When I use function atoi() in my code, I get the following linker
errors:
\usr\local\arm\arm-elf\lib/libc.a(strtol.o)(.text+0x90): In function
`_strtol_r'
:
../../../../../newlib-1.12.0/newlib/libc/stdlib/strtol.c:186: undefined
referenc
e to `__umodsi3'
\usr\local\arm\arm-elf\lib/libc.a(strtol.o)(.text+0xa0):../../../../../newlib-1.
12.0/newlib/libc/stdlib/strtol.c:187: undefined reference to
`__udivsi3'
The code was linked as follows:
arm-ld -d -b elf32-littlearm -e __start -EL -static -nostdlib
-nostartfiles -L\u
sr\local\arm\arm-elf\lib -T linker-arm-gcc.lcf _vectors.o
_startup.o exceptions
.o main.o -lc -lm -Map a.map -o a.elf
References to __umodsi3 and __udivsi3 appear in divsi3.c in
machine/h8500 and machine/w65, but not in machine/arm.
Apparently, when newlib is built for ARM, there is no divsi3.c with the
necessary references. A bug?
I've built newlib like this for the PowerPC and had no such problem.