Linking troubles.


I am trying to link a few compiled object files into an ELF. These are the steps I am following

arm-none-eabi-gcc -S printf.c -o kprintf.s -I .
arm-none-eabi-gcc -S main.c -o main.s -I .

arm-none-eabi-as -mlittle-endian -o kprintf.o kprintf.s
arm-none-eabi-as -mlittle-endian -o main.o main.s

arm-none-eabi-ld -Ttext 0x80008000 -entry start_armboot --start-group main.o kprintf.o --end-group -L /usr/local/gcc-arm/lib/gcc/arm-none-eabi/4.5.2/ -o u-boot

and receive an error

kprintf.o: In function number': printf.c:(.text+0x3c8): undefined reference to __aeabi_uidivmod’
printf.c:(.text+0x3e4): undefined reference to `__aeabi_uidiv’
arm-none-eabi-objcopy: ‘u-boot’: No such file

Looking into the map of the xloader, I believe that the routines come from libgcc.a

.text 0x0000000040205528 0x114 /usr/local/gcc-arm/lib/gcc/arm-none-eabi/4.5.2/libgcc.a(_udivsi3.o)

0x0000000040205528 __udivsi3
0x0000000040205528 __aeabi_uidiv
0x000000004020561c __aeabi_uidivmod
.text 0x000000004020563c 0x148 /usr/local/gcc-arm/lib/gcc/arm-none-eabi/4.5.2/libgcc.a(_divsi3.o)
0x000000004020563c __aeabi_idiv
0x000000004020563c __divsi3
0x0000000040205764 __aeabi_idivmod
.text 0x0000000040205784 0x4 /usr/local/gcc-arm/lib/gcc/arm-none-eabi/4.5.2/libgcc.a(_dvmd_tls.o)
0x0000000040205784 __aeabi_ldiv0
0x0000000040205784 __aeabi_idiv0

What could I be doing wrong?

Thank you.

I was just pointed to a gcc bug on the TI OMAP3 forum. Can anyone suggest a work around?