Skip to contentSkip to conversation

raid6/ppc: Fix build for clang

PATCH Superseded Joel Stanley 3 participants 4 messages Oct 31, 2018 – Nov 1, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 raid6/ppc: Fix build for clang

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

Quoted 8 lines · Jinsong Ji

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.

---
 lib/raid6/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
lib/raid6/Makefile +15 -0
index 2f8b61dfd9b0..3a844e6fd01c 100644
@@ -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
Signature · 1 line
2.19.1
#1 lore raw
Quoted 11 lines · Joel Stanley

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

Quoted 6 lines · Jinsong Ji

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.

Quoted 8 lines
Quoted 2 lines

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.

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!

Quoted 9 lines
---
 lib/raid6/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
lib/raid6/Makefile +0 -0
index 2f8b61dfd9b0..3a844e6fd01c 100644

lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 22

Quoted 5 lines
lib/raid6/Makefile +2 -0
@@ -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?

Quoted 19 lines
lib/raid6/Makefile +13 -1
+# 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

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
Quoted 42 lines · Nick Desaulniers
Quoted 11 lines · Joel Stanley

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

Quoted 6 lines · Jinsong Ji

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.

Quoted 8 lines
Quoted 2 lines

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.

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!

Quoted 9 lines
---
 lib/raid6/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
lib/raid6/Makefile +0 -0
index 2f8b61dfd9b0..3a844e6fd01c 100644

lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 22

Quoted 5 lines
lib/raid6/Makefile +2 -0
@@ -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:

Quoted 4 lines

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/[email protected]/

cheers

#3 lore raw
Quoted 46 lines · Michael Ellerman
Quoted 44 lines · Nick Desaulniers
Quoted 11 lines · Joel Stanley

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

Quoted 6 lines · Jinsong Ji

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.

Quoted 8 lines
Quoted 2 lines

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.

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!

Quoted 9 lines
---
 lib/raid6/Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
lib/raid6/Makefile +0 -0
index 2f8b61dfd9b0..3a844e6fd01c 100644

lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 22

Quoted 5 lines
lib/raid6/Makefile +2 -0
@@ -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)

Quoted 8 lines
Quoted 2 lines

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/[email protected]/

cheers

Cool, thanks for the link!

Signature · 2 lines
Thanks,
~Nick Desaulniers