aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-08-13 14:30:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-13 15:03:24 -0400
commitc7dcf87a6881bf796faee83003163eb3de41a309 (patch)
tree1e4333e588ad6e8e69e310d8ae71798af1c0bdb5 /kernel
parent2be1f3a73dd02e38e181cf5abacb3d45a6a2d6b8 (diff)
time: Workaround gcc loop optimization that causes 64bit div errors
Early 4.3 versions of gcc apparently aggressively optimize the raw time accumulation loop, replacing it with a divide. On 32bit systems, this causes the following link errors: undefined reference to `__umoddi3' undefined reference to `__udivdi3' The gcc issue has been fixed in 4.4 and greater. This patch replaces the accumulation loop with a do_div, as suggested by Linus. Signed-off-by: John Stultz <johnstul@us.ibm.com> CC: Jason Wessel <jason.wessel@windriver.com> CC: Larry Finger <Larry.Finger@lwfinger.net> CC: Ingo Molnar <mingo@elte.hu> CC: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/timekeeping.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e960d824263f..49010d822f72 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -710,9 +710,10 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
710 /* Accumulate raw time */ 710 /* Accumulate raw time */
711 raw_nsecs = timekeeper.raw_interval << shift; 711 raw_nsecs = timekeeper.raw_interval << shift;
712 raw_nsecs += raw_time.tv_nsec; 712 raw_nsecs += raw_time.tv_nsec;
713 while (raw_nsecs >= NSEC_PER_SEC) { 713 if (raw_nsecs >= NSEC_PER_SEC) {
714 raw_nsecs -= NSEC_PER_SEC; 714 u64 raw_secs = raw_nsecs;
715 raw_time.tv_sec++; 715 raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
716 raw_time.tv_sec += raw_secs;
716 } 717 }
717 raw_time.tv_nsec = raw_nsecs; 718 raw_time.tv_nsec = raw_nsecs;
718 719