From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753742AbdDERoE (ORCPT ); Wed, 5 Apr 2017 13:44:04 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:36814 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbdDERnZ (ORCPT ); Wed, 5 Apr 2017 13:43:25 -0400 Date: Wed, 5 Apr 2017 10:43:23 -0700 From: Matthias Kaehlcke To: Ard Biesheuvel Cc: Greg Hackmann , Herbert Xu , "David S . Miller" , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , "linux-crypto@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Grant Grundler , Michael Davidson , Robin Murphy Subject: Re: [PATCH] crypto: arm64/sha: use %c constraint code in ASM_EXPORT Message-ID: <20170405174323.GC145051@google.com> References: <20170405165603.87264-1-mka@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hoi Ard! El Wed, Apr 05, 2017 at 06:08:37PM +0100 Ard Biesheuvel ha dit: > On 5 April 2017 at 17:56, Matthias Kaehlcke wrote: > > From: Greg Hackmann > > > > The current definition of ASM_EXPORT doesn't work properly with clang, > > according to https://bugs.llvm.org//show_bug.cgi?id=27250#c3 it relies on > > gcc specific behavior. Change the constraint from an intermediate to an > > output expression which works with both gcc and clang. > > > > From: Greg Hackmann > > Commit-message-by: Matthias Kaehlcke > > Signed-off-by: Greg Hackmann > > Signed-off-by: Matthias Kaehlcke > > --- > > arch/arm64/crypto/sha1-ce-glue.c | 2 +- > > arch/arm64/crypto/sha2-ce-glue.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm64/crypto/sha1-ce-glue.c b/arch/arm64/crypto/sha1-ce-glue.c > > index aefda9868627..c71e94ba0e43 100644 > > --- a/arch/arm64/crypto/sha1-ce-glue.c > > +++ b/arch/arm64/crypto/sha1-ce-glue.c > > @@ -18,7 +18,7 @@ > > #include > > > > #define ASM_EXPORT(sym, val) \ > > - asm(".globl " #sym "; .set " #sym ", %0" :: "I"(val)); > > + asm(".globl " #sym "; .set " #sym ", %c0" :: "I"(val)); > > > > MODULE_DESCRIPTION("SHA1 secure hash using ARMv8 Crypto Extensions"); > > MODULE_AUTHOR("Ard Biesheuvel "); > > diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c > > index 7cd587564a41..381b5fb2dcb2 100644 > > --- a/arch/arm64/crypto/sha2-ce-glue.c > > +++ b/arch/arm64/crypto/sha2-ce-glue.c > > @@ -18,7 +18,7 @@ > > #include > > > > #define ASM_EXPORT(sym, val) \ > > - asm(".globl " #sym "; .set " #sym ", %0" :: "I"(val)); > > + asm(".globl " #sym "; .set " #sym ", %c0" :: "I"(val)); > > > > MODULE_DESCRIPTION("SHA-224/SHA-256 secure hash using ARMv8 Crypto Extensions"); > > MODULE_AUTHOR("Ard Biesheuvel "); > > I am fine with this change, although I would really like to add a > better reference to the commit log. It is *very* difficult to find any > documentation regarding non-trivial uses of inline asm constraints, > and if %c0 is the correct syntax, surely we can quote something better > than a LLVM bugzilla entry? Also, where does the distinction between > 'intermediate' vs 'output' expression come from? To be honest assembly is not really my area of expertise and I relayed the information from the LLVM bug. The link to the gcc doc on x86(!) operand modifiers posted by Robin Murphy (thanks!) should be helpful to provide a more accurate commit message. Thanks Matthias