Linux kernel compilation error: undefined reference to `__udivdi3 'and` __umoddi3'

Here is my mistake: 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' 

I googled and found this patch: 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++; } 

but failed to apply (possibly due to a new version of the file).

  patching file linux/time.h Hunk #1 FAILED at 174. 1 out of 1 hunk FAILED -- saving rejects to file linux/time.h.rej 

surprisingly the time.h.rej file time.h.rej missing!

+4
source share
1 answer

I should read more carefully. The patch is for timespec_add_ns() , and you have the functions gem_rxmac_reset() and divide.part.4 . divide.part.4 . Probably not related to the patch you found - instead, probably the standard 64-bit div / mod functions do not have an implementation on your target platform.

Do you have a Sun GEM or Apple GMAC NIC? If not, you can simply disable this driver and get rid of the first error message.

For the second, you may need to implement a similar asm trick in the clkdev.c file - when I removed my copy for the subtraction operation, which I did not notice, but maybe you can just steal a new clkdev.c or clkdev.h to fix this problem? (This is a long snapshot, there is only one entry in git log drivers/clk/clkdev.c .)

+1
source

Source: https://habr.com/ru/post/1384564/


All Articles