linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Chanho Min <chanho.min@lge.com>,
	Kyungsik Lee <kyungsik.lee@lge.com>,
	Yann Collet <yann.collet.73@gmail.com>,
	Bob Pearson <rpearson@systemfabricworks.com>,
	Richard Weinberger <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	sparclinux <sparclinux@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>,
	Linux-Next <linux-next@vger.kernel.org>
Subject: Re: [PATCH] lib: add weak __clzsi2()/__clzdi2() functions
Date: Tue, 30 Apr 2013 14:46:05 -0700	[thread overview]
Message-ID: <20130430144605.1a99a7397702b332ee818fc8@linux-foundation.org> (raw)
In-Reply-To: <CAMuHMdWk4oi_KCmZv7hLZ7JSwy=meziKPBMQ1HJiJR9W8AdrDg@mail.gmail.com>

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.

  reply	other threads:[~2013-04-30 21:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-29  5:40 [PATCH] lib: add weak __clzsi2()/__clzdi2() functions Chanho Min
2013-04-29  7:20 ` Geert Uytterhoeven
2013-04-30 21:46   ` Andrew Morton [this message]
2013-05-01  7:35     ` Geert Uytterhoeven
2013-05-02  0:58     ` 민찬호
2013-04-30 19:47 ` Andrew Morton

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=20130430144605.1a99a7397702b332ee818fc8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chanho.min@lge.com \
    --cc=geert@linux-m68k.org \
    --cc=kyungsik.lee@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=rpearson@systemfabricworks.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=yann.collet.73@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).