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.

John Stultz committed 16 years ago

Commit c7dcf871 parent 2be1f3a1 file · +4 −3Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/time/timekeeping.c+4−3
@@ -710,9 +710,10 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) · 709 unmodified lines
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