kernel/built-in.o: In function `getnstimeofday':
(.text+0xee36): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0xeee1): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0xeefe): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_timer':
(.text+0xfd88): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_timer':
(.text+0xfda5): undefined reference to `__umoddi3'
make: *** [.tmp_vmlinux1] Error 1
Solution:
---
include/linux/time.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/linux/time.h b/include/linux/time.h
index 2091a19..d32ef0a 100644
--- 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)); // Include this line in the file /include/linux/time.h
+
ns -= NSEC_PER_SEC;
a->tv_sec++;
}
-- This patch prevents gcc form "optimizing" the while loop into a costly modulo. operation

No comments:
Post a Comment