(转)Unknown symbol __udivdi3 && Unknown symbol...

来源:百度文库 编辑:神马文学网 时间:2024/10/02 18:20:49
(转)来自:http://www.captain.at/howto-udivdi3-umoddi3.php

If you've encountered an error message like this
Unknown symbol __udivdi3
Unknown symbol __umoddi3
Unresolved symbol __udivdi3
Unresolved symbol __umoddi3
you most likely want to make a 64 bit division, which is not supported by default in linux kernel space.

To solve this problem, you need to use the do_div macro available in asm/div64.h:
#include 
unsigned long long x, y, result;
unsigned long mod;
mod = do_div(x, y);
result = x;
If you want to calculate x / y with do_div(x, y), the result of the division is in x, the remainder is returned from the do_div function.

Since do_div is just an asm (assembler) macro, it doesn't break real time determinism, so it's also suitable for use in RTAI classic, RTAI fusion and ADEOS/ADEOS-IPIPE applications.