linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com,
	Dmitry Golovin <dima@golovin.in>
Subject: Re: [PATCH] lib/mpi: Fix 64-bit MIPS build with Clang
Date: Thu, 30 Apr 2020 15:30:04 +1000	[thread overview]
Message-ID: <20200430053004.GC11738@gondor.apana.org.au> (raw)
In-Reply-To: <20200421214703.47883-1-natechancellor@gmail.com>

On Tue, Apr 21, 2020 at 02:47:04PM -0700, Nathan Chancellor wrote:
> When building 64r6_defconfig with CONFIG_MIPS32_O32 disabled and
> CONFIG_CRYPTO_RSA enabled:
> 
> lib/mpi/generic_mpih-mul1.c:37:24: error: invalid use of a cast in a
> inline asm context requiring an l-value: remove the cast
> or build with -fheinous-gnu-extensions
>                 umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
>                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/mpi/longlong.h:664:22: note: expanded from macro 'umul_ppmm'
>                  : "=d" ((UDItype)(w0))
>                          ~~~~~~~~~~^~~
> lib/mpi/generic_mpih-mul1.c:37:13: error: invalid use of a cast in a
> inline asm context requiring an l-value: remove the cast
> or build with -fheinous-gnu-extensions
>                 umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
>                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/mpi/longlong.h:668:22: note: expanded from macro 'umul_ppmm'
>                  : "=d" ((UDItype)(w1))
>                          ~~~~~~~~~~^~~
> 2 errors generated.
> 
> This special case for umul_ppmm for MIPS64r6 was added in
> commit bbc25bee37d2b ("lib/mpi: Fix umul_ppmm() for MIPS64r6"), due to
> GCC being inefficient and emitting a __multi3 intrinsic.
> 
> There is no such issue with clang; with this patch applied, I can build
> this configuration without any problems and there are no link errors
> like mentioned in the commit above (which I can still reproduce with
> GCC 9.3.0 when that commit is reverted). Only use this definition when
> GCC is being used.
> 
> This really should have been caught by commit b0c091ae04f67 ("lib/mpi:
> Eliminate unused umul_ppmm definitions for MIPS") when I was messing
> around in this area but I was not testing 64-bit MIPS at the time.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/885
> Reported-by: Dmitry Golovin <dima@golovin.in>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  lib/mpi/longlong.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      reply	other threads:[~2020-04-30  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 21:47 [PATCH] lib/mpi: Fix 64-bit MIPS build with Clang Nathan Chancellor
2020-04-30  5:30 ` Herbert Xu [this message]

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=20200430053004.GC11738@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dima@golovin.in \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@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).