2011年4月6日

time.h: undefined reference to `__aeabi_uldivmod'

linux_2_6_21/include/linux/time.h:184: undefined reference to `__aeabi_uldivmod'

Kernel: v2.6.21.1
Compiler: gcc v4.3.3

Solution:

From http://lkml.org/lkml/2008/2/22/464.

--- include/linux/time.h 2008-10-09 19:47:23.000000000 +0200
+++ include/linux/time.h.new 2008-10-09 19:47:54.000000000 +0200
@@ -173,6 +173,10 @@
{
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++;
}

0 意見: