__udivdi3 and linux kernel u64 division question [x86]
Hi list members,
After a failure of compilation of the similar code snippet
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?
Quoted 8 lines · Mateusz Berezecki
Hi list members,
After a failure of compilation of the similar code snippet
u64 mconst = somebig64bitvalue;
u64 tmp = some32bitvalue;
u64 r = mconst / tmp;
you shouldn't do this in linux
Quoted 3 lines
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?
do_div is a very small subset of divides.
Also.. you forgot to put the URL of your module into your email..
Quoted 12 lines · Mateusz Berezecki
u64 mconst = somebig64bitvalue;
u64 tmp = some32bitvalue;
u64 r = mconst / tmp;I encounter compilation error and gcc reporting
__udivdi3has 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?
Quoted 3 lines
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
Signature · 4 lines
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));