lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 1 May 2013 09:35:35 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Chanho Min <chanho.min@....com>,
	Kyungsik Lee <kyungsik.lee@....com>,
	Yann Collet <yann.collet.73@...il.com>,
	Bob Pearson <rpearson@...temfabricworks.com>,
	Richard Weinberger <richard@....at>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	sparclinux <sparclinux@...r.kernel.org>,
	"Linux/m68k" <linux-m68k@...r.kernel.org>,
	Linux-Next <linux-next@...r.kernel.org>
Subject: Re: [PATCH] lib: add weak __clzsi2()/__clzdi2() functions

On Tue, Apr 30, 2013 at 11:46 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Mon, 29 Apr 2013 09:20:25 +0200 Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
>> On Mon, Apr 29, 2013 at 7:40 AM, Chanho Min <chanho.min@....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@...ux-m68k.org>
>> > Signed-off-by: Chanho Min <chanho.min@....com>
>>
>> Thanks, this fixes the link error on m68k, so
>>
>> Acked-by: Geert Uytterhoeven <geert@...ux-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.

No, the link errors are for __ctzdi2, not __clzdi2.
__ctzdi2 can be implemented using __ffs().

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

That was my first suggestion ;-)

> 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.

Indeed. It should be hardcoded 32.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists