OpenWrt Forum Archive

Topic: Compile OK, insmod gives undefined symbols

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I'm trying to get a kernel module (aodv) working on whiterussian rc3. I've got a version of it cross-compiled and working, but the version I need to use has some customisations in it and I'm having great trouble getting this one working. I'm not a coder by trade, so I'm getting a bit out of depth with this.

Both the vanilla code and the custom code will compile fine without any problems, and just a few warnings. The problem comes when I transfer it to my linksys router and try to insmod it.

The vanilla version insmods ok, but the custom version gives:

Using /tmp/kernel_aodv_arm.o
insmod: unresolved symbol __udivdi3

I've tried adding -lgcc (along with the correct -L path) but it makes no difference

CFLAGS:
-O2 -DMODULE -D__KERNEL__ -DLINUX -DMESSAGES -Wall -fomit-frame-pointer -fno-strict-aliasing -mno-abicalls -pipe -mlong-calls -DEXPORT_SYMTAB -c -march=mips32 -G 0  -mips32 -Wa,--trap  -DKBUILD_MODNAME="aodv" -DLOCUSTWORLD -Wl,--gc-sections -ffunction-sections  -fno-pic

LDFLAGS
mipsel-linux-ld -r

Can anyone shed any light on this or point me in the right direction?

Cheers,

Darren.

Well, it seems that the code was doing some division sums, and the wrt didn't like them. I used the do_div function and seperated out any sums to keep the division seperate.

Now the module just segfaults on insertion! sad

Anyone give me any pointers on how to debug this?

Cheers,

Darren.

dpoulson wrote:

Well, it seems that the code was doing some division sums, and the wrt didn't like them. I used the do_div function and seperated out any sums to keep the division seperate.

Now the module just segfaults on insertion! sad

Anyone give me any pointers on how to debug this?

Cheers,

Darren.

any pointers to the code of the kernel module?

The discussion might have continued from here.