Re: __udivdi3 and linux kernel u64 division question [x86]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-05-24 14:29:44 +0200, Mateusz Berezecki <[email protected]> wrote:
> u64 mconst = somebig64bitvalue;
> u64 tmp = some32bitvalue;
> u64 r = mconst / tmp;
> 
> I encounter compilation error and gcc reporting __udivdi3 has not been
> found!
> After firing up cscope I found that this function has never(?) been
> implemented for
> x86 architecture. How is it possible that during compilation process of
> some module
> make system tries to link with nonexisting function?
> 
> I've also found a do_div() and it was sufficent for my purposes but Im
> still curious about
> __udivdi3. Can someone explain this issue to me?

In some cases, gcc decides that a given division is too complicated to
do it in one assembler instruction. That's especially true for things
that newer CPUs support but older lack.  In these cases, gcc emits a
function call instead of the actual division and normally, libgcc would
provide these functions.

However, it's each architecture's decision to link-in libgcc or not,
because it can open another can of worms. Alternatively, you can
implement these little functions on your own and put them somewhere in
some library file.

MfG, JBG

-- 
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux