public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.32.2: undefined reference to `__udivdi3'
@ 2009-12-20 12:10 arvids
  0 siblings, 0 replies; 4+ messages in thread
From: arvids @ 2009-12-20 12:10 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

Hi,

2.6.32.2 fails to compile:
  LD      .tmp_vmlinux1
drivers/built-in.o(.text+0x15755e): In function `menu_select':
: undefined reference to `__udivdi3'
make: *** [.tmp_vmlinux1] Error 1

$gcc -v
Reading specs from /usr/lib/gcc/i486-slackware-linux/3.4.6/specs
Configured 
with: ../gcc-3.4.6/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.4.6
(Slackware 11.0.0)

2.6.31.x compiled fine with this system.

Regards, Arvids

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 2.6.32.2: undefined reference to `__udivdi3'
@ 2009-12-21 18:22 Mike Garrison
  2009-12-21 20:21 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Garrison @ 2009-12-21 18:22 UTC (permalink / raw)
  To: linux-kernel

Same problem as Arvids and Andreas:

  LD      .tmp_vmlinux1
drivers/built-in.o: In function `menu_select':
menu.c:(.text+0x139711): undefined reference to `__udivdi3'
make: *** [.tmp_vmlinux1] Error 1

Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.5/specs
Configured with: ./configure --prefix=/usr --enable-shared --enable-languages=c,c++ --enable-threads=posix --with-slibdir=/lib --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.5

This is a custom build of Linux based on Linux From Scratch. I've had no issues with 2.6.31.X

--
Mike Garrison

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.32.2: undefined reference to `__udivdi3'
  2009-12-21 18:22 2.6.32.2: undefined reference to `__udivdi3' Mike Garrison
@ 2009-12-21 20:21 ` Stephen Hemminger
  2009-12-22 10:28   ` Arjan van de Ven
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2009-12-21 20:21 UTC (permalink / raw)
  To: Mike Garrison, Andrew Morton, Arjan van de Ven, Len Brown,
	Venkatesh Pallipadi, Corrado Zoccolo
  Cc: linux-kernel

The new menu governor driver is written by Intel folks who never use 32-bit
anymore it seems :-)
---------------------------------------------------------
Subject: [PATCH] menu: use proper 64 bit math

The new menu governor is incorrectly doing a 64 bit divide.
Compile tested only

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/cpuidle/governors/menu.c	2009-12-21 12:02:25.840083589 -0800
+++ b/drivers/cpuidle/governors/menu.c	2009-12-21 12:16:42.418834255 -0800
@@ -18,6 +18,7 @@
 #include <linux/hrtimer.h>
 #include <linux/tick.h>
 #include <linux/sched.h>
+#include <linux/math64.h>
 
 #define BUCKETS 12
 #define RESOLUTION 1024
@@ -169,6 +170,12 @@ static DEFINE_PER_CPU(struct menu_device
 
 static void menu_update(struct cpuidle_device *dev);
 
+/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
+static u64 div_round64(u64 dividend, u32 divisor)
+{
+	return div_u64(dividend + (divisor / 2), divisor);
+}
+
 /**
  * menu_select - selects the next idle state to enter
  * @dev: the CPU
@@ -209,9 +216,8 @@ static int menu_select(struct cpuidle_de
 		data->correction_factor[data->bucket] = RESOLUTION * DECAY;
 
 	/* Make sure to round up for half microseconds */
-	data->predicted_us = DIV_ROUND_CLOSEST(
-		data->expected_us * data->correction_factor[data->bucket],
-		RESOLUTION * DECAY);
+	data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket],
+					 RESOLUTION * DECAY);
 
 	/*
 	 * We want to default to C1 (hlt), not to busy polling

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.32.2: undefined reference to `__udivdi3'
  2009-12-21 20:21 ` Stephen Hemminger
@ 2009-12-22 10:28   ` Arjan van de Ven
  0 siblings, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2009-12-22 10:28 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Mike Garrison, Andrew Morton, Len Brown, Venkatesh Pallipadi,
	Corrado Zoccolo, linux-kernel

On 12/21/2009 21:21, Stephen Hemminger wrote:
> The new menu governor driver is written by Intel folks who never use 32-bit
> anymore it seems :-)

more like "by people who use a compiler that knows how to divide by a power of 2" :)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-22 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-21 18:22 2.6.32.2: undefined reference to `__udivdi3' Mike Garrison
2009-12-21 20:21 ` Stephen Hemminger
2009-12-22 10:28   ` Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2009-12-20 12:10 arvids

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox