LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] raid6/ppc: Fix build for clang
@ 2018-10-31  3:28 Joel Stanley
  2018-10-31 19:54 ` Nick Desaulniers
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2018-10-31  3:28 UTC (permalink / raw)
  To: Michael Ellerman, linux-kernel, linuxppc-dev
  Cc: Arnd Bergmann, Kees Cook, Nick Desaulniers, Jinsong Ji

We cannot build these files with clang as it does not allow altivec
instructions in assembly when -msoft-float is passed.

Jinsong Ji <jji@us.ibm.com> wrote:
> We currently disable Altivec/VSX support when enabling soft-float.  So
> any usage of vector builtins will break.
>
> Enable Altivec/VSX with soft-float may need quite some clean up work, so
> I guess this is currently a limitation.
>
> Removing -msoft-float will make it work (and we are lucky that no
> floating point instructions will be generated as well).

This is a workaround until the issue is resolved in clang.

Link: https://bugs.llvm.org/show_bug.cgi?id=31177
Link: https://github.com/ClangBuiltLinux/linux/issues/239
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 lib/raid6/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
index 2f8b61dfd9b0..3a844e6fd01c 100644
--- a/lib/raid6/Makefile
+++ b/lib/raid6/Makefile
@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL  $@
 
 ifeq ($(CONFIG_ALTIVEC),y)
 altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
+
+ifdef CONFIG_CC_IS_CLANG
+# clang ppc port does not yet support -maltifec when -msoft-float is
+# enabled. A future release of clang will resolve this
+# https://bugs.llvm.org/show_bug.cgi?id=31177
+CFLAGS_REMOVE_altivec1.o  += -msoft-float
+CFLAGS_REMOVE_altivec2.o  += -msoft-float
+CFLAGS_REMOVE_altivec4.o  += -msoft-float
+CFLAGS_REMOVE_altivec8.o  += -msoft-float
+CFLAGS_REMOVE_altivec8.o  += -msoft-float
+CFLAGS_REMOVE_vpermxor1.o += -msoft-float
+CFLAGS_REMOVE_vpermxor2.o += -msoft-float
+CFLAGS_REMOVE_vpermxor4.o += -msoft-float
+CFLAGS_REMOVE_vpermxor8.o += -msoft-float
+endif
 endif
 
 # The GCC option -ffreestanding is required in order to compile code containing
-- 
2.19.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] raid6/ppc: Fix build for clang
  2018-10-31  3:28 [PATCH] raid6/ppc: Fix build for clang Joel Stanley
@ 2018-10-31 19:54 ` Nick Desaulniers
  2018-11-01  4:38   ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2018-10-31 19:54 UTC (permalink / raw)
  To: joel; +Cc: mpe, LKML, linuxppc-dev, Arnd Bergmann, Kees Cook, jji

On Tue, Oct 30, 2018 at 8:28 PM Joel Stanley <joel@jms.id.au> wrote:
>
> We cannot build these files with clang as it does not allow altivec
> instructions in assembly when -msoft-float is passed.
>
> Jinsong Ji <jji@us.ibm.com> wrote:
> > We currently disable Altivec/VSX support when enabling soft-float.  So
> > any usage of vector builtins will break.
> >
> > Enable Altivec/VSX with soft-float may need quite some clean up work, so
> > I guess this is currently a limitation.
> >
> > Removing -msoft-float will make it work (and we are lucky that no
> > floating point instructions will be generated as well).
>
> This is a workaround until the issue is resolved in clang.
>
> Link: https://bugs.llvm.org/show_bug.cgi?id=31177
> Link: https://github.com/ClangBuiltLinux/linux/issues/239
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Hopefully we can have this fixed up soon.  I'll try to see who works
on Clang+PPC here and see if they can help move that bug along. Thanks
for the patch!

> ---
>  lib/raid6/Makefile | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
> index 2f8b61dfd9b0..3a844e6fd01c 100644
> --- a/lib/raid6/Makefile
> +++ b/lib/raid6/Makefile
> @@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL  $@
>
>  ifeq ($(CONFIG_ALTIVEC),y)
>  altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
> +
> +ifdef CONFIG_CC_IS_CLANG

Note that the top level makefile detects clang via:

ifeq ($(cc-name),clang)

Does that not work here? I'd prefer to keep compiler detection in
Makefiles consistent, if it works?

> +# clang ppc port does not yet support -maltifec when -msoft-float is
> +# enabled. A future release of clang will resolve this
> +# https://bugs.llvm.org/show_bug.cgi?id=31177
> +CFLAGS_REMOVE_altivec1.o  += -msoft-float
> +CFLAGS_REMOVE_altivec2.o  += -msoft-float
> +CFLAGS_REMOVE_altivec4.o  += -msoft-float
> +CFLAGS_REMOVE_altivec8.o  += -msoft-float
> +CFLAGS_REMOVE_altivec8.o  += -msoft-float
> +CFLAGS_REMOVE_vpermxor1.o += -msoft-float
> +CFLAGS_REMOVE_vpermxor2.o += -msoft-float
> +CFLAGS_REMOVE_vpermxor4.o += -msoft-float
> +CFLAGS_REMOVE_vpermxor8.o += -msoft-float
> +endif
>  endif
>
>  # The GCC option -ffreestanding is required in order to compile code containing
> --
> 2.19.1
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] raid6/ppc: Fix build for clang
  2018-10-31 19:54 ` Nick Desaulniers
@ 2018-11-01  4:38   ` Michael Ellerman
  2018-11-01 16:05     ` Nick Desaulniers
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2018-11-01  4:38 UTC (permalink / raw)
  To: Nick Desaulniers, joel; +Cc: LKML, linuxppc-dev, Arnd Bergmann, Kees Cook, jji

Nick Desaulniers <ndesaulniers@google.com> writes:
> On Tue, Oct 30, 2018 at 8:28 PM Joel Stanley <joel@jms.id.au> wrote:
>>
>> We cannot build these files with clang as it does not allow altivec
>> instructions in assembly when -msoft-float is passed.
>>
>> Jinsong Ji <jji@us.ibm.com> wrote:
>> > We currently disable Altivec/VSX support when enabling soft-float.  So
>> > any usage of vector builtins will break.
>> >
>> > Enable Altivec/VSX with soft-float may need quite some clean up work, so
>> > I guess this is currently a limitation.
>> >
>> > Removing -msoft-float will make it work (and we are lucky that no
>> > floating point instructions will be generated as well).
>>
>> This is a workaround until the issue is resolved in clang.
>>
>> Link: https://bugs.llvm.org/show_bug.cgi?id=31177
>> Link: https://github.com/ClangBuiltLinux/linux/issues/239
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>
> Hopefully we can have this fixed up soon.  I'll try to see who works
> on Clang+PPC here and see if they can help move that bug along. Thanks
> for the patch!
>
>> ---
>>  lib/raid6/Makefile | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
>> index 2f8b61dfd9b0..3a844e6fd01c 100644
>> --- a/lib/raid6/Makefile
>> +++ b/lib/raid6/Makefile
>> @@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL  $@
>>
>>  ifeq ($(CONFIG_ALTIVEC),y)
>>  altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
>> +
>> +ifdef CONFIG_CC_IS_CLANG
>
> Note that the top level makefile detects clang via:
>
> ifeq ($(cc-name),clang)
>
> Does that not work here? I'd prefer to keep compiler detection in
> Makefiles consistent, if it works?

cc-name is being removed in favor of CONFIG_CC_IS_CLANG:

https://lore.kernel.org/lkml/1540905994-6073-1-git-send-email-yamada.masahiro@socionext.com/

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] raid6/ppc: Fix build for clang
  2018-11-01  4:38   ` Michael Ellerman
@ 2018-11-01 16:05     ` Nick Desaulniers
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2018-11-01 16:05 UTC (permalink / raw)
  To: mpe; +Cc: joel, LKML, linuxppc-dev, Arnd Bergmann, Kees Cook, jji

On Wed, Oct 31, 2018 at 9:38 PM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Nick Desaulniers <ndesaulniers@google.com> writes:
> > On Tue, Oct 30, 2018 at 8:28 PM Joel Stanley <joel@jms.id.au> wrote:
> >>
> >> We cannot build these files with clang as it does not allow altivec
> >> instructions in assembly when -msoft-float is passed.
> >>
> >> Jinsong Ji <jji@us.ibm.com> wrote:
> >> > We currently disable Altivec/VSX support when enabling soft-float.  So
> >> > any usage of vector builtins will break.
> >> >
> >> > Enable Altivec/VSX with soft-float may need quite some clean up work, so
> >> > I guess this is currently a limitation.
> >> >
> >> > Removing -msoft-float will make it work (and we are lucky that no
> >> > floating point instructions will be generated as well).
> >>
> >> This is a workaround until the issue is resolved in clang.
> >>
> >> Link: https://bugs.llvm.org/show_bug.cgi?id=31177
> >> Link: https://github.com/ClangBuiltLinux/linux/issues/239
> >> Signed-off-by: Joel Stanley <joel@jms.id.au>
> >
> > Hopefully we can have this fixed up soon.  I'll try to see who works
> > on Clang+PPC here and see if they can help move that bug along. Thanks
> > for the patch!
> >
> >> ---
> >>  lib/raid6/Makefile | 15 +++++++++++++++
> >>  1 file changed, 15 insertions(+)
> >>
> >> diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
> >> index 2f8b61dfd9b0..3a844e6fd01c 100644
> >> --- a/lib/raid6/Makefile
> >> +++ b/lib/raid6/Makefile
> >> @@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL  $@
> >>
> >>  ifeq ($(CONFIG_ALTIVEC),y)
> >>  altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
> >> +
> >> +ifdef CONFIG_CC_IS_CLANG
> >
> > Note that the top level makefile detects clang via:
> >
> > ifeq ($(cc-name),clang)
> >
> > Does that not work here? I'd prefer to keep compiler detection in
> > Makefiles consistent, if it works?
>
> cc-name is being removed in favor of CONFIG_CC_IS_CLANG:
>
> https://lore.kernel.org/lkml/1540905994-6073-1-git-send-email-yamada.masahiro@socionext.com/
>
> cheers

Cool, thanks for the link!

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-01 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  3:28 [PATCH] raid6/ppc: Fix build for clang Joel Stanley
2018-10-31 19:54 ` Nick Desaulniers
2018-11-01  4:38   ` Michael Ellerman
2018-11-01 16:05     ` Nick Desaulniers

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