"__aeabi_ldivmod";编译内核模块时未定义 [英] "__aeabi_ldivmod" undefined when compiling kernel module

查看:980
本文介绍了"__aeabi_ldivmod";编译内核模块时未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在树莓派上编译一个内核模块(我自己写了).我正在目标环境中对其进行编译.

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

我得到以下输出:

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'

果然,如果我尝试插入模块,我会得到:

Sure enough, if I try to insert the module, I get:

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

并在系统日志中:

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

在我的模块中,我已识别出导致问题的行:

In my module, I have identified the line causing the problem:

unsigned int chan_abs_val = tdiff / CHAN_SCALE;

(其中tdiff是s64,而CHAN_SCALE是整数文字).

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

如果我将划分意见排除在外,问题就解决了.那是我模块中唯一使用除法的行.

If I comment the division out, the problem goes away. That is the only line using division in my module.

进行了一些谷歌搜索,发现了一些有关此问题的参考,但是在编译内核模块的上下文中找不到.

A bit of googling turned up a few references to this issue, but none I could find in the context of compiling kernel modules.

我的makefile看起来像这样:

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

环境详细信息:

  • Pi正在运行Pidora 2014(Fedora 20).
  • 内核为3.12.23-1.20140626git25673c3.rpfr20.armv6hl.bcm2708.
  • gcc是4.8.2.

更新

我显然没有使用正确的词进行搜索. 其他搜索购买了许多参考文献,但没有这样的解决方案.阅读它们,我得到的意见是,如果要为ARM进行编译,则不应在内核内进行任何64位划分?

I obviously did not search using the correct terms. Another search has bought up many references, but no solutions as such. Reading them I am getting the opinion that one should not do any 64bit divisions inside the kernel if one wants to compile for ARM?

推荐答案

在大多数32位CPU上,必须使用慢速库函数来实现64位除法. 为了防止编译器生成明显慢的代码,Linux不实现这些功能.

On most 32-bit CPUs, 64-bit division must be implemented with a slow library function. To prevent the compiler from generating unobviously slow code, Linux does not implement these functions.

如果要进行64位除法,则必须显式地进行. 使用<asm/div64.h>中的do_div().

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

这篇关于"__aeabi_ldivmod";编译内核模块时未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆