You are right, it doesn't need to be patched. I don't have a kernel handy, but Google Code Search <http://www.google.com/codesearch/> shows me it was in the main kernel branch in 2.6.24 and was in 2.6.25, so I assume this has been permanently fixed in later versions. While searching I did find a number of other places where fixes similar to this one have been applied to the 2.4 and 2.6 kernels, so the information might be useful in the future. Have fun, D. blaze your trail -- redhat http://feeds.feedburner.com/GeneralMusing 2009/11/1 Herbert Poetzl <herbert@13thfloor.at> > On Sun, Nov 01, 2009 at 04:18:46AM +0000, Daniël W. Crompton wrote: > > Sorry Herbert you are absolutely right. > > > From Gentoo Portage, 2.6.22-vs2.2.0.7-gentoo, using gcc > > (Gentoo 4.3.2-r3 p1.6, pie-10.1.5) 4.3.2 > > that kernel is 1.5 years old, and your gcc is pretty > new, so it optimizes out the loop and uses a div/mod, > which is not available to the kernel (lack of libgcc) > > I think the patch you mentioned should be fine, but > I see no point in adding it to the 2.6.22.x branch ... > (would require additional testing with older and newer > gcc as well as verification that it doesn't harm > anything) > > possible alternative solutions: > > - get an older gcc, which is known to compile that > kernel fine (vanilla) > > - get a newer kernel, preferably 2.6.31.x and use > that instead of the old 2.6.22.x branch > > best, > Herbert > > > Ciao, > > Daniel > > > blaze your trail > > > -- > > redhat > > > > http://feeds.feedburner.com/GeneralMusing > > > > 2009/10/31 Herbert Poetzl <herbert@13thfloor.at> > > > > > On Sat, Oct 31, 2009 at 07:04:33PM +0000, Daniël W. Crompton wrote: > > > > Happy Halloween, > > > > > > > > I was getting a error (below) while compiling a new kernel, I found > out > > > that > > > > a patch (also below) was required for linux/include/time.h as part of > the > > > > code is being optimized away losing the references. > > > > > > > > I check the vserver mailing list and didn't see any post about this > > > issue, > > > > so I am posting it here so we now have a record of it. > > > > > > > > Ciao, > > > > Daniel > > > > > > > > > > > > *ERROR:* > > > > make bzImage > > > > ... > > > > LD .tmp vmlinux1 > > > > kernel/built-in.o: In function `getnstimeofday': > > > > (.text+0x22bdc): undefined reference to ` umoddi3' > > > > kernel/built-in.o: In function `getnstimeofday': > > > > (.text+0x22bfc): undefined reference to ` udivdi3' > > > > kernel/built-in.o: In function `do gettimeofday': > > > > (.text+0x22d0e): undefined reference to ` udivdi3' > > > > kernel/built-in.o: In function `do gettimeofday': > > > > (.text+0x22d2c): undefined reference to ` umoddi3' > > > > kernel/built-in.o: In function `timekeeping resume': > > > > timekeeping.c:(.text+0x22fd4): undefined reference to ` umoddi3' > > > > timekeeping.c:(.text+0x22ff4): undefined reference to ` udivdi3' > > > > kernel/built-in.o: In function `update wall time': > > > > (.text+0x23306): undefined reference to ` umoddi3' > > > > kernel/built-in.o: In function `update wall time': > > > > (.text+0x23326): undefined reference to ` udivdi3' > > > > kernel/built-in.o: In function `update wall time': > > > > (.text+0x23796): undefined reference to ` umoddi3' > > > > kernel/built-in.o: In function `update wall time': > > > > (.text+0x237b6): undefined reference to ` udivdi3' > > > > make: *** [.tmp vmlinux1] Error 1 > > > > > > what kernel and Linux-VServer patch is that? > > > and what compiler do you use? > > > > > > TIA, > > > Herbert > > > > > > > *PATCH:* > > > > > > > > diff --git a/include/linux/time.h b/include/linux/time.h > > > > index 2091a19..d32ef0a 100644 > > > > --- a/include/linux/time.h > > > > +++ b/include/linux/time.h > > > > > > > > @@ -174,6 +174,10 @@ static inline void timespec add ns(struct > > > > timespec *a, u64 ns) > > > > { > > > > ns += a->tv nsec; > > > > while(unlikely(ns >= NSEC PER SEC)) { > > > > + /* The following asm() prevents the compiler from > > > > > > > > + * optimising this loop into a modulo operation. */ > > > > + asm("" : "+r"(ns)); > > > > + > > > > ns -= NSEC PER SEC; > > > > a->tv sec++; > > > > } > > > > > > > > > > > > > > > > > > > > blaze your trail > > > > > > > > -- > > > > redhat > > > > > > > > http://feeds.feedburner.com/GeneralMusing > > > >
On Sun, Nov 01, 2009 at 04:18:46AM +0000, Daniël W. Crompton wrote:that kernel is 1.5 years old, and your gcc is pretty
> Sorry Herbert you are absolutely right.
> From Gentoo Portage, 2.6.22-vs2.2.0.7-gentoo, using gcc
> (Gentoo 4.3.2-r3 p1.6, pie-10.1.5) 4.3.2
new, so it optimizes out the loop and uses a div/mod,
which is not available to the kernel (lack of libgcc)
I think the patch you mentioned should be fine, but
I see no point in adding it to the 2.6.22.x branch ...
(would require additional testing with older and newer
gcc as well as verification that it doesn't harm
anything)
possible alternative solutions:
- get an older gcc, which is known to compile that
kernel fine (vanilla)
- get a newer kernel, preferably 2.6.31.x and use
that instead of the old 2.6.22.x branch
best,
Herbert
> Ciao,
> Daniel
> blaze your trail
> --
> redhat
>
> http://feeds.feedburner.com/GeneralMusing
>
> 2009/10/31 Herbert Poetzl <herbert@13thfloor.at>
>
> > On Sat, Oct 31, 2009 at 07:04:33PM +0000, Daniël W. Crompton wrote:
> > > Happy Halloween,
> > >
> > > I was getting a error (below) while compiling a new kernel, I found out
> > that
> > > a patch (also below) was required for linux/include/time.h as part of the
> > > code is being optimized away losing the references.
> > >
> > > I check the vserver mailing list and didn't see any post about this
> > issue,
> > > so I am posting it here so we now have a record of it.
> > >
> > > Ciao,
> > > Daniel
> > >
> > >
> > > *ERROR:*
> > > make bzImage
> > > ...
> > > LD .tmp vmlinux1
> > > kernel/built-in.o: In function `getnstimeofday':
> > > (.text+0x22bdc): undefined reference to ` umoddi3'
> > > kernel/built-in.o: In function `getnstimeofday':
> > > (.text+0x22bfc): undefined reference to ` udivdi3'
> > > kernel/built-in.o: In function `do gettimeofday':
> > > (.text+0x22d0e): undefined reference to ` udivdi3'
> > > kernel/built-in.o: In function `do gettimeofday':
> > > (.text+0x22d2c): undefined reference to ` umoddi3'
> > > kernel/built-in.o: In function `timekeeping resume':
> > > timekeeping.c:(.text+0x22fd4): undefined reference to ` umoddi3'
> > > timekeeping.c:(.text+0x22ff4): undefined reference to ` udivdi3'
> > > kernel/built-in.o: In function `update wall time':
> > > (.text+0x23306): undefined reference to ` umoddi3'
> > > kernel/built-in.o: In function `update wall time':
> > > (.text+0x23326): undefined reference to ` udivdi3'
> > > kernel/built-in.o: In function `update wall time':
> > > (.text+0x23796): undefined reference to ` umoddi3'
> > > kernel/built-in.o: In function `update wall time':
> > > (.text+0x237b6): undefined reference to ` udivdi3'
> > > make: *** [.tmp vmlinux1] Error 1
> >
> > what kernel and Linux-VServer patch is that?
> > and what compiler do you use?
> >
> > TIA,
> > Herbert
> >
> > > *PATCH:*
> > >
> > > diff --git a/include/linux/time.h b/include/linux/time.h
> > > index 2091a19..d32ef0a 100644
> > > --- a/include/linux/time.h
> > > +++ b/include/linux/time.h
> > >
> > > @@ -174,6 +174,10 @@ static inline void timespec add ns(struct
> > > timespec *a, u64 ns)
> > > {
> > > ns += a->tv nsec;
> > > while(unlikely(ns >= NSEC PER SEC)) {
> > > + /* The following asm() prevents the compiler from
> > >
> > > + * optimising this loop into a modulo operation. */
> > > + asm("" : "+r"(ns));
> > > +
> > > ns -= NSEC PER SEC;
> > > a->tv sec++;
> > > }
> > >
> > >
> > >
> > >
> > > blaze your trail
> > >
> > > --
> > > redhat
> > >
> > > http://feeds.feedburner.com/GeneralMusing
> >