Actions
| Post | |
| Subscribe | |
| Unsubscribe |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[arm-gnu] arm-none-gnueabi can't divide with -Os? (undefined reference to `__aeabi_uidiv')
- To: arm-gnu@xxxxxxxxxxxxxxxx
- Subject: [arm-gnu] arm-none-gnueabi can't divide with -Os? (undefined reference to `__aeabi_uidiv')
- From: "Andrew Kohlsmith (mailing lists account)" <aklists@xxxxxxxxxx>
- Date: Mon, 1 Mar 2010 23:09:06 -0500
Good evening, everyone,
I have a standalone embedded application and I'm having a bit of a time trying
to get integer division to work. I'm using the gcc from the arm-2009q3-68-arm-
none-eabi.bin installer on the site, installed to my home directory using the
default install.
I'm building for an LPC2103 system with the following command:
arm-none-eabi-gcc -g -Os -fno-builtin -mcpu=arm7tdmi -c -o rtc.o rtc.c
The problem occurs at link time:
arm-none-eabi-ld -T rom.ld -Map foo.map --cref -o foo boot.o main.o rtc.o
oled.o spiflash.o uart.o ubcsp.o vibe.o rle.o button.o font.o printf.o irq.o
rtc.o: In function `udelay':
/home/andrew/foo/rtc.c:18: undefined reference to `__aeabi_uidiv'
make: *** [foo] Error 1
Now line 18 of rtc.c is just a divide:
ticks /= 15;
__aeabi_uidiv is part of libgcc.a. If I change the routine so the divide does
not occur, the embedded code works fine. If I add libgcc.a manually to the ld
line, the code will build, but causes the CPU to enter abort mode. If I use -
O0, -O2 or -O6 (I don't know if that's a valid optimization level), the code
builds and works fine. Something is odd with optimization and the emulated
divide function, at least on arm7tdmi.
If I try to build with thumb instructions (with -mthumb -mthumb-interwork), I
get the same undefined reference error no matter what optimization level I
choose (or leave out of the command entirely).
I'm getting around it by now by not using thumb mode where I need to divide,
and using -O2 for the code that must divide, but I think you guys might like
to know about this (or at least show us how to do it if it's a known issue.)
Regards,
Andrew
- Follow-Ups:
- Prev by Date: Re: [arm-gnu] Bug fix for linux/uio.h (arm-2009q3 lite)
- Next by Date: Re: [arm-gnu] arm-none-gnueabi can't divide with -Os? (undefined reference to `__aeabi_uidiv')
- Previous by thread: Re: [arm-gnu] Bug fix for linux/uio.h (arm-2009q3 lite)
- Next by thread: Re: [arm-gnu] arm-none-gnueabi can't divide with -Os? (undefined reference to `__aeabi_uidiv')
- Index(es):