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

查看:32
本文介绍了“__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.

我的生成文件如下所示:

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 位除法,则必须明确进行.使用 中的 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天全站免登陆