Commit [c7dcf8]  Maximize  Restore  History

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 <>
CC: Jason Wessel <>
CC: Larry Finger <>
CC: Ingo Molnar <>
CC: Linus Torvalds <>
Signed-off-by: Linus Torvalds <>

John Stultz John Stultz 2010-08-13

Linus Torvalds Linus Torvalds 2010-08-13

changed kernel
changed kernel/time
changed kernel/time/timekeeping.c
kernel/time/timekeeping.c Diff Switch to side-by-side view