"__aeabi_ldivmod" undefined when compiling a kernel module

I am trying to compile a kernel module (which I wrote myself) on raspberry pi. I am compiling it in the target environment.

I get the following output:

make -C /lib/modules/3.12.23-1.20140626git25673c3.rpfr20.armv6hl.bcm2708/build M=/home/harmic/horus/ppminput modules make[1]: Entering directory `/usr/src/kernels/3.12.23-1.20140626git25673c3.rpfr20.armv6hl.bcm2708' CC [M] /home/harmic/horus/ppminput/ppminput.o Building modules, stage 2. MODPOST 1 modules WARNING: "__aeabi_ldivmod" [/home/harmic/horus/ppminput/ppminput.ko] undefined! CC /home/harmic/horus/ppminput/ppminput.mod.o LD [M] /home/harmic/horus/ppminput/ppminput.ko make[1]: Leaving directory `/usr/src/kernels/3.12.23-1.20140626git25673c3.rpfr20.armv6hl.bcm2708' 

Of course, if I try to insert a module, I get:

 insmod: ERROR: could not insert module ./ppminput.ko: Unknown symbol in module 

and in syslog:

 Sep 2 22:44:26 pidora kernel: [ 7589.354709] ppminput: Unknown symbol __aeabi_ldivmod (err 0) 

In my module, I defined the line causing the problem:

 unsigned int chan_abs_val = tdiff / CHAN_SCALE; 

(where tdiff is s64 and CHAN_SCALE is an integer literal).

If I comment on the separation, the problem will disappear. This is the only line using split in my module.

A bit of a search engine showed several links to this problem, but I could not find it in the context of compiling kernel modules.

My makefile looks like this:

 obj-m += ppminput.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 

Environment Details:

  • Pi launches Pidora 2014 (Fedora 20).
  • The kernel is 3.12.23-1.20140626git25673c3.rpfr20.armv6hl.bcm2708.
  • gcc - 4.8.2.

Update

I obviously did not search using the correct conditions. Another search bought a lot of links, but no solutions as such. Reading them, I get the opinion that there should be no 64-bit divisions in the kernel if you want to compile for ARM?

+7
c linux-kernel raspberry-pi undefined-symbol
source share
1 answer

On most 32-bit processors, 64-bit division should be implemented using the slow library function. To prevent the compiler from generating unobtrusively slow code, Linux does not perform these functions.

If you want to do 64-bit divisions, you must do it explicitly. Use do_div() from <asm/div64.h> .

+11
source share

All Articles