[pkg-fso-commits] [SCM] linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko branch, stable, updated. upstream/20080903.git2ea34171-31-g9706327

Andy Green agreen at pads.home.warmcat.com
Tue Nov 11 21:39:17 UTC 2008


The following commit has been merged in the stable branch:
commit f5b973489beb1a1239dfad53e3ad6e36ff7ee958
Author: Segher Boessenkool <segher at kernel.crashing.org>
Date:   Thu Oct 9 21:18:27 2008 +0100

    fix-gcc-4.3-false-modulo-optimization.patch
    
    I tried to compile the current stable kernel
    (a2ef813d2f439a3e9f377d33a2e5baad098afb7e)
    and get the following errors:
    
    kernel/built-in.o: In function `timespec_add_ns':
    /mnt/data/Freerunner/Gentoo/rootinstall/usr/src/linux/include/linux/time.h:174:
    undefined reference to `__aeabi_uldivmod'
    /mnt/data/Freerunner/Gentoo/rootinstall/usr/src/linux/include/linux/time.h:179:
    undefined reference to `__aeabi_uldivmod'
    /mnt/data/Freerunner/Gentoo/rootinstall/usr/src/linux/include/linux/time.h:174:
    undefined reference to `__aeabi_uldivmod'
    /mnt/data/Freerunner/Gentoo/rootinstall/usr/src/linux/include/linux/time.h:179:
    undefined reference to `__aeabi_uldivmod'
    
    applying the following patch solved the problem:
    --------
    Prevent gcc-4.3 form "optimizing" the while loop into a costly modulo operation.
    Patch found at http://lkml.org/lkml/2008/2/22/464.
    
    Reported-by: Sven Rebhan <odinshorse at googlemail.com>
    Signed-off-by: Segher Boessenkool <segher at kernel.crashing.org>

diff --git a/include/linux/time.h b/include/linux/time.h
index b04136d..3e8fd9e 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -173,6 +173,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++;
 	}

-- 
linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko



More information about the pkg-fso-commits mailing list