linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Malaterre <malat@debian.org>
To: Joel Stanley <joel@jms.id.au>
Cc: Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: [PATCH] crypto: Fix build for clang
Date: Fri, 21 Jun 2019 09:44:47 +0200	[thread overview]
Message-ID: <CA+7wUsxW1D3k+Vfe_sh9816jQLutd0K2QRTesRtKkCBwwWax2g@mail.gmail.com> (raw)
In-Reply-To: <CACPK8XcJgtCHqrHuNe6f2eLDKWvHRP-uEq1ozOdEnsmED-KL2Q@mail.gmail.com>

Joel,

On Fri, Jun 21, 2019 at 9:30 AM Joel Stanley <joel@jms.id.au> wrote:
>
> On Fri, 21 Jun 2019 at 07:13, Mathieu Malaterre <malat@debian.org> wrote:
> >
> > The header file `longlong.h` makes uses of GNU extensions, this trigger
> > an error when compiling this code with clang. Add a special flag to make
> > clang tolerate this syntax.
>
> Another old copy of longlong.h in the kernel!
>
> This looks similar to another clang related warnings I fixed in the
> powerpc math-emu code. There's an updated version of these macros in
> GCC, and we updated the kernel version to match the GCC version. Can
> you see if a similar change would work here?
>
> https://lore.kernel.org/linuxppc-dev/43BCRQ6ZqDz9s55@ozlabs.org/
> https://git.kernel.org/torvalds/c/b682c8692442711684befe413cf93cf01c5324ea

Great ! Thanks for the pointer. Looks like a much bettter solution in
the long term. Will try asap.

> Cheers,
>
> Joel
>
> >
> > Silence the following warnings triggered using W=1:
> >
> >     CC      lib/mpi/generic_mpih-mul1.o
> >   ../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:824:20: note: expanded from macro 'umul_ppmm'
> >           : "=r" ((USItype) ph) \
> >                   ~~~~~~~~~~^~
> >
> > and
> >
> >     CC      lib/mpi/generic_mpih-mul2.o
> >   ../lib/mpi/generic_mpih-mul2.c:36: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:824:20: note: expanded from macro 'umul_ppmm'
> >           : "=r" ((USItype) ph) \
> >                   ~~~~~~~~~~^~
> >
> >   1 warning generated.
> >     CC      lib/mpi/generic_mpih-mul3.o
> >   ../lib/mpi/generic_mpih-mul3.c:36: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:824:20: note: expanded from macro 'umul_ppmm'
> >           : "=r" ((USItype) ph) \
> >                   ~~~~~~~~~~^~
> >
> > Or even:
> >
> >   ../lib/mpi/mpih-div.c:99:16: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
> >                                   sub_ddmmss(n1, n0, n1, n0, d1, d0);
> >                                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
> >
> > Cc: Joel Stanley <joel@jms.id.au>
> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Signed-off-by: Mathieu Malaterre <malat@debian.org>
> > ---
> >  lib/mpi/Makefile | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/lib/mpi/Makefile b/lib/mpi/Makefile
> > index d5874a7f5ff9..de4d96e988a3 100644
> > --- a/lib/mpi/Makefile
> > +++ b/lib/mpi/Makefile
> > @@ -5,6 +5,13 @@
> >
> >  obj-$(CONFIG_MPILIB) = mpi.o
> >
> > +ifdef CONFIG_CC_IS_CLANG
> > +CFLAGS_generic_mpih-mul1.o  += -fheinous-gnu-extensions
> > +CFLAGS_generic_mpih-mul2.o  += -fheinous-gnu-extensions
> > +CFLAGS_generic_mpih-mul3.o  += -fheinous-gnu-extensions
> > +CFLAGS_mpih-div.o  += -fheinous-gnu-extensions
> > +endif
> > +
> >  mpi-y = \
> >         generic_mpih-lshift.o           \
> >         generic_mpih-mul1.o             \
> > --
> > 2.20.1
> >

  reply	other threads:[~2019-06-21  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  7:13 [PATCH] crypto: Fix build for clang Mathieu Malaterre
2019-06-21  7:29 ` Joel Stanley
2019-06-21  7:44   ` Mathieu Malaterre [this message]
2019-06-21 19:55 ` [PATCH v2] lib/mpi: fix build with clang Mathieu Malaterre
2019-06-25  4:03   ` Joel Stanley
2019-06-25 18:15   ` Segher Boessenkool

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=CA+7wUsxW1D3k+Vfe_sh9816jQLutd0K2QRTesRtKkCBwwWax2g@mail.gmail.com \
    --to=malat@debian.org \
    --cc=dmitry.kasatkin@intel.com \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=segher@kernel.crashing.org \
    --cc=yamada.masahiro@socionext.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).