public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jason Wessel <jason.wessel@windriver.com>,
	John Stultz <johnstul@us.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Problem with commit deda2e81961e96be4f2c09328baca4710a2fd1a0
Date: Thu, 12 Aug 2010 15:41:33 -0500	[thread overview]
Message-ID: <4C645C7D.1050903@lwfinger.net> (raw)
In-Reply-To: <AANLkTi==5umTtLWSoLfLPjHYAVpnPNHN-uzq7q2t-nfr@mail.gmail.com>

On 08/12/2010 03:26 PM, Linus Torvalds wrote:
> On Thu, Aug 12, 2010 at 1:18 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
>>
>> With the above commit, building an i386 version of the kernel results in the
>> following from the build:
>>
>> kernel/built-in.o: In function `logarithmic_accumulation':
>> /home/finger/linux-realtek/kernel/time/timekeeping.c:715: undefined reference to
>> `__umoddi3'
>> /home/finger/linux-realtek/kernel/time/timekeeping.c:715: undefined reference to
>> `__udivdi3'
>> make: *** [.tmp_vmlinux1] Error 1
>>
>> Reverting the patch allows the system to build correctly.
> 
> Damn. It's your compiler turning a while-loop into a divide. Which
> likely isn't even an optimization, but whatever.
> 
> John: I think that while-loop needs to be something like
> 
>    if (raw_nsecs >= NSEC_PER_SEC) {
>       u64 raw_secs = raw_nsecs;
>       raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
>       raw_time.tv_sec += taw_secs;
>   }
>   raw_time.tc_nsec = raw_nsecs;
> 
> which is sad and overly complicated, but the simple thing seems to get
> messed up by the compiler.
> 
> Untested. Maybe I got the complex do_div() semantics wrong. Somebody
> needs to check.

I'll try it. The system with the problem has gcc (SUSE Linux) 4.3.2
[gcc-4_3-branch revision 141291]. That is on a 64-bit system cross compiling
with ARCH=i386.

The real 32-bit system with gcc (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch
revision 160292] builds OK. It just wasn't finished when I wrote the first message.

Larry


  reply	other threads:[~2010-08-12 20:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 20:18 Problem with commit deda2e81961e96be4f2c09328baca4710a2fd1a0 Larry Finger
2010-08-12 20:26 ` Linus Torvalds
2010-08-12 20:41   ` Larry Finger [this message]
2010-08-13  8:45     ` Mikael Pettersson
2010-08-12 20:52 ` john stultz
2010-08-13  3:17   ` Larry Finger
2010-08-13  7:30     ` john stultz
2010-08-13 11:53       ` Jason Wessel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C645C7D.1050903@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=jason.wessel@windriver.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox