lkml.org 
[lkml]   [2013]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lib: add weak __clzsi2()/__clzdi2() functions
On Mon, 29 Apr 2013 09:20:25 +0200 Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Mon, Apr 29, 2013 at 7:40 AM, Chanho Min <chanho.min@lge.com> wrote:
> > Some architectures need __clzsi2() or __clzdi2() for __builtin_clz and
> > It causes build failure. They can be implemented using the fls() and
> > overridden by linking arch-specific versions may not be implemented yet.
> >
> > Reference: https://lkml.org/lkml/2013/4/18/603
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Signed-off-by: Chanho Min <chanho.min@lge.com>
>
> Thanks, this fixes the link error on m68k, so
>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

It doesn't work for alpha (gcc-4.4.4):

ERROR: "__ctzdi2" [lib/lz4/lz4hc_compress.ko] undefined!
ERROR: "__ctzdi2" [lib/lz4/lz4_compress.ko] undefined!

akpm3:/usr/src/25> nm vmlinux|grep ctzd
akpm3:/usr/src/25>

I assume the linker threw the code away.


How's about we stop using __builtin_ctz[ll]() altogether? Use N-fls()?

btw, this:

int __weak __clzsi2(int val)
{
return BITS_PER_LONG - fls(val);
}

looks wrong. It will give a different result for 32- and 64-bit.


\
 
 \ /
  Last update: 2013-05-01 00:01    [W:0.053 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site