I compiled code that divided a "long long" by 1000 and tried to store
the result into a "long". It compiled without complaints (-Wall), but
when linking I got the message "undefined reference to `__divdi3'".
Down-casting the "long long" to a plain "long" before the divide
solved the problem.
The original code was something like
#define L_GINT(v) ((v) < 0 ? -(-(v) >> 32) : (v) >> 32)
txc->offset is long, time_offset is long long
txc->offset = L_GINT(time_offset) / 1000;
and I was compiling with SuSE Linux 6.0 on a Pentium-100. The message
from the linker was:
kernel/kernel.o: In function `update_wall_time':
kernel/kernel.o(.text+0x832c): undefined reference to `__divdi3'
kernel/kernel.o: In function `do_adjtimex':
kernel/kernel.o(.text+0x92bb): undefined reference to `__divdi3'
make: *** [vmlinux] Error 1
The version of gcc seems to be
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.3/specs
gcc version 2.7.2.3
(SuSE gcc-2.7.2.3-5)
Regards,
Ulrich Windl
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/