LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-2.6.21 and __udivid3
@ 2007-04-26 15:24 l l
  2007-04-26 15:32 ` Peter Zijlstra
  2007-04-26 17:55 ` Adrian Bunk
  0 siblings, 2 replies; 7+ messages in thread
From: l l @ 2007-04-26 15:24 UTC (permalink / raw)
  To: linux-kernel

Hi,

How to link libgcc.a with linux-2.6.21?

  LD      .tmp_vmlinux1
kernel/built-in.o: In function `timespec_add_ns':
/usr/src/linux-2.6.21/kernel/timer.c:828: undefined reference to `__udivdi3'
/usr/src/linux-2.6.21/kernel/timer.c:841: undefined reference to `__udivdi3'
/usr/src/linux-2.6.21/kernel/timer.c:1311: undefined reference to `__udivdi3'
make[1]: *** [.tmp_vmlinux1] Error 1
make[1]: Leaving directory `/usr/src/linux-2.6.21'
make: *** [debian/stamp-build-kernel] Error 2

cc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr --libexecdir=/usr/lib
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-languages=c,c++,treelang
--with-system-zlib --with-gmp --enable-mpfr
--enable-libstdcxx-allocator=mt
Thread model: posix
gcc version 4.3.0 20070420 (experimental)

TIA

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

* Re: linux-2.6.21 and __udivid3
  2007-04-26 15:24 linux-2.6.21 and __udivid3 l l
@ 2007-04-26 15:32 ` Peter Zijlstra
  2007-04-26 17:55 ` Adrian Bunk
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Zijlstra @ 2007-04-26 15:32 UTC (permalink / raw)
  To: l l; +Cc: linux-kernel

On Fri, 2007-04-27 at 00:24 +0900, l l wrote:
> Hi,
> 
> How to link libgcc.a with linux-2.6.21?

you don't, in kernel one is supposed to used do_div() for 64/32.

>   LD      .tmp_vmlinux1
> kernel/built-in.o: In function `timespec_add_ns':
> /usr/src/linux-2.6.21/kernel/timer.c:828: undefined reference to `__udivdi3'
> /usr/src/linux-2.6.21/kernel/timer.c:841: undefined reference to `__udivdi3'
> /usr/src/linux-2.6.21/kernel/timer.c:1311: undefined reference to `__udivdi3'
> make[1]: *** [.tmp_vmlinux1] Error 1
> make[1]: Leaving directory `/usr/src/linux-2.6.21'
> make: *** [debian/stamp-build-kernel] Error 2

I'm not seeing any /s there about. Is this a pristine tree?

> cc -v
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: ../gcc/configure --prefix=/usr --libexecdir=/usr/lib
> --enable-shared --enable-threads=posix --enable-__cxa_atexit
> --enable-clocale=gnu --enable-languages=c,c++,treelang
> --with-system-zlib --with-gmp --enable-mpfr
> --enable-libstdcxx-allocator=mt
> Thread model: posix
> gcc version 4.3.0 20070420 (experimental)
> 
> TIA
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


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

* Re: linux-2.6.21 and __udivid3
  2007-04-26 15:24 linux-2.6.21 and __udivid3 l l
  2007-04-26 15:32 ` Peter Zijlstra
@ 2007-04-26 17:55 ` Adrian Bunk
  2007-04-26 19:57   ` Stephen Hemminger
  2007-04-27  0:30   ` l l
  1 sibling, 2 replies; 7+ messages in thread
From: Adrian Bunk @ 2007-04-26 17:55 UTC (permalink / raw)
  To: l l; +Cc: linux-kernel

On Fri, Apr 27, 2007 at 12:24:32AM +0900, l l wrote:
> Hi,
>
> How to link libgcc.a with linux-2.6.21?
>
>  LD      .tmp_vmlinux1
> kernel/built-in.o: In function `timespec_add_ns':
> /usr/src/linux-2.6.21/kernel/timer.c:828: undefined reference to 
> `__udivdi3'
> /usr/src/linux-2.6.21/kernel/timer.c:841: undefined reference to 
> `__udivdi3'
> /usr/src/linux-2.6.21/kernel/timer.c:1311: undefined reference to 
> `__udivdi3'
> make[1]: *** [.tmp_vmlinux1] Error 1
> make[1]: Leaving directory `/usr/src/linux-2.6.21'
> make: *** [debian/stamp-build-kernel] Error 2

I assume this is a plain 2.6.21 from ftp.kernel.org?

> cc -v
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: ../gcc/configure --prefix=/usr --libexecdir=/usr/lib
> --enable-shared --enable-threads=posix --enable-__cxa_atexit
> --enable-clocale=gnu --enable-languages=c,c++,treelang
> --with-system-zlib --with-gmp --enable-mpfr
> --enable-libstdcxx-allocator=mt
> Thread model: posix
> gcc version 4.3.0 20070420 (experimental)

Can you reproduce this with gcc 4.1?
If yes, please send your .config .

> TIA

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: linux-2.6.21 and __udivid3
  2007-04-26 17:55 ` Adrian Bunk
@ 2007-04-26 19:57   ` Stephen Hemminger
  2007-04-27  0:30   ` l l
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2007-04-26 19:57 UTC (permalink / raw)
  To: linux-kernel

On Thu, 26 Apr 2007 19:55:26 +0200
Adrian Bunk <bunk@stusta.de> wrote:

> On Fri, Apr 27, 2007 at 12:24:32AM +0900, l l wrote:
> > Hi,
> >
> > How to link libgcc.a with linux-2.6.21?
> >
> >  LD      .tmp_vmlinux1
> > kernel/built-in.o: In function `timespec_add_ns':
> > /usr/src/linux-2.6.21/kernel/timer.c:828: undefined reference to 
> > `__udivdi3'
> > /usr/src/linux-2.6.21/kernel/timer.c:841: undefined reference to 
> > `__udivdi3'
> > /usr/src/linux-2.6.21/kernel/timer.c:1311: undefined reference to 
> > `__udivdi3'
> > make[1]: *** [.tmp_vmlinux1] Error 1
> > make[1]: Leaving directory `/usr/src/linux-2.6.21'
> > make: *** [debian/stamp-build-kernel] Error 2
> 
> I assume this is a plain 2.6.21 from ftp.kernel.org?
> 
> > cc -v
> > Using built-in specs.
> > Target: i686-pc-linux-gnu
> > Configured with: ../gcc/configure --prefix=/usr --libexecdir=/usr/lib
> > --enable-shared --enable-threads=posix --enable-__cxa_atexit
> > --enable-clocale=gnu --enable-languages=c,c++,treelang
> > --with-system-zlib --with-gmp --enable-mpfr
> > --enable-libstdcxx-allocator=mt
> > Thread model: posix
> > gcc version 4.3.0 20070420 (experimental)
> 
> Can you reproduce this with gcc 4.1?
> If yes, please send your .config .
> 
> > TIA
> 
> cu
> Adrian
> 

I wonder if GCC 4.3 is trying to optimize this loop into a divide/remainder?
If so, then it is time to give the gcc developers a little talking to.


static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
	ns += a->tv_nsec;
	while(unlikely(ns >= NSEC_PER_SEC)) {
		ns -= NSEC_PER_SEC;
		a->tv_sec++;
	}
	a->tv_nsec = ns;
}


-- 
Stephen Hemminger <shemminger@linux-foundation.org>

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

* Re: linux-2.6.21 and __udivid3
  2007-04-26 17:55 ` Adrian Bunk
  2007-04-26 19:57   ` Stephen Hemminger
@ 2007-04-27  0:30   ` l l
  2007-04-27  0:56     ` l l
  1 sibling, 1 reply; 7+ messages in thread
From: l l @ 2007-04-27  0:30 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

Hi,

Sorry for the late, i was in my bed.

> I assume this is a plain 2.6.21 from ftp.kernel.org?

Yes.

> Can you reproduce this with gcc 4.1?
> If yes, please send your .config .

I don't, i think i have to go back to gcc-4.2.0 which was fine with
linux-2.6.21-rc7.
It will be same to 2.6.21.

TIA

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

* Re: linux-2.6.21 and __udivid3
  2007-04-27  0:30   ` l l
@ 2007-04-27  0:56     ` l l
  2007-04-27  9:11       ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: l l @ 2007-04-27  0:56 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

It attachs,

Here is another compilation failure.

make
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CHK     include/linux/compile.h
  CC [M]  drivers/w1/w1.o
drivers/w1/w1.c: In function 'w1_slave_read_id':
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
make[2]: *** [drivers/w1/w1.o] Error 1
make[1]: *** [drivers/w1] Error 2
make: *** [drivers] Error 2



> I don't, i think i have to go back to gcc-4.2.0 which was fine with
> linux-2.6.21-rc7.
> It will be same to 2.6.21.

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

* Re: linux-2.6.21 and __udivid3
  2007-04-27  0:56     ` l l
@ 2007-04-27  9:11       ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2007-04-27  9:11 UTC (permalink / raw)
  To: l l; +Cc: Adrian Bunk, linux-kernel, Evgeniy Polyakov

On Fri, 27 Apr 2007 09:56:03 +0900 "l l" <happyarch@gmail.com> wrote:

> Here is another compilation failure.
> 
> make
>   CHK     include/linux/version.h
>   CHK     include/linux/utsrelease.h
>   CHK     include/linux/compile.h
>   CC [M]  drivers/w1/w1.o
> drivers/w1/w1.c: In function 'w1_slave_read_id':
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> drivers/w1/w1.c:118: error: cannot take address of bit-field 'family'
> make[2]: *** [drivers/w1/w1.o] Error 1
> make[1]: *** [drivers/w1] Error 2
> make: *** [drivers] Error 2

hm,

		memcpy(buf, (u8 *)&sl->reg_num, count);

and

struct w1_reg_num
{
#if defined(__LITTLE_ENDIAN_BITFIELD)
	__u64	family:8,
		id:48,
		crc:8;
#elif defined(__BIG_ENDIAN_BITFIELD)
	__u64	crc:8,
		id:48,
		family:8;
#else
#error "Please fix <asm/byteorder.h>"
#endif
};

the compiler is being a bit pedantic there, IMO.  What version of gcc are
you using?

Does this help?


--- a/drivers/w1/w1.h~w1-build-fix
+++ a/drivers/w1/w1.h
@@ -22,19 +22,23 @@
 #ifndef __W1_H
 #define __W1_H
 
-struct w1_reg_num
-{
+struct w1_reg_num {
+	union {
+		__u64 unused;	/* So gcc will permit pointers to this struct */
+		struct {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
-	__u64	family:8,
-		id:48,
-		crc:8;
+			__u64	family:8,
+				id:48,
+				crc:8;
 #elif defined(__BIG_ENDIAN_BITFIELD)
-	__u64	crc:8,
-		id:48,
-		family:8;
+			__u64	crc:8,
+				id:48,
+				family:8;
 #else
 #error "Please fix <asm/byteorder.h>"
 #endif
+		};
+	};
 };
 
 #ifdef __KERNEL__
_


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

end of thread, other threads:[~2007-04-27  9:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-26 15:24 linux-2.6.21 and __udivid3 l l
2007-04-26 15:32 ` Peter Zijlstra
2007-04-26 17:55 ` Adrian Bunk
2007-04-26 19:57   ` Stephen Hemminger
2007-04-27  0:30   ` l l
2007-04-27  0:56     ` l l
2007-04-27  9:11       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).