这是我遇到的错误: http://pastebin.com/VadUW6fy
drivers/built-in.o: In function `gem_rxmac_reset':
clkdev.c:(.text+0x212238): undefined reference to `__bad_udelay'
drivers/built-in.o: In function `divide.part.4':
clkdev.c:(.text.unlikely+0x7214): undefined reference to `__udivdi3'
clkdev.c:(.text.unlikely+0x7244): undefined reference to `__umoddi3'
我用谷歌搜索并找到了这个补丁:https://lkml.org/lkml/2008/4/7/82
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -174,6 +174,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
ns += a->tv_nsec;
while(unlikely(ns >= NSEC_PER_SEC)) {
+ /* The following asm() prevents the compiler from
+ * optimising this loop into a modulo operation. */
+ asm("" : "+r"(ns));
+
ns -= NSEC_PER_SEC;
a->tv_sec++;
}
但申请失败(可能是文件的新版本)
patching file linux/time.h
Hunk #1 FAILED at 174.
1 out of 1 hunk FAILED -- saving rejects to file linux/time.h.rej
令人惊讶的是,文件 time.h.rej
不存在!
最佳答案
我应该更仔细地阅读。该补丁适用于 timespec_add_ns()
,并且您有 gem_rxmac_reset()
和 divide.part.4
函数失败。可能与您找到的补丁无关——相反,标准的 64 位 div/mod 函数可能在您的目标平台上没有实现。
您有 Sun GEM 或 Apple GMAC NIC 吗?如果没有,您可能只需禁用该驱动程序并摆脱第一条错误消息。
对于第二个,您可能需要在 clkdev.c
文件中实现类似的 asm
技巧——当我浏览我的副本以进行重复的减法操作时,我没有没有发现 - 但也许您可以简单地窃取更新的 clkdev.c
或 clkdev.h
来解决这个问题? (不太可能,git log drivers/clk/clkdev.c
中只有 一个 条目。)
关于Linux内核编译错误: undefined reference to `__udivdi3' & `__umoddi3' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8374969/