linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Build ppc64le kernel with llvm/clang
@ 2015-05-25 22:53 Anton Blanchard
  2015-05-25 22:53 ` [PATCH 1/6] powerpc: Fix duplicate const clang warning in user access code Anton Blanchard
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

Now that Michael has fixed the 32 bit VDSO issue in his next branch, there are only
a few remaining things left to get the ppc64le kernel building with clang.

The last patch is a hack to workaround some generic Makefile issues. Hopefully the
relevant bits of the LLVMLinux tree will get merged upstream to fix them.

Anton Blanchard (6):
  powerpc: Fix duplicate const clang warning in user access code
  powerpc: Only use -mabi=altivec if toolchain supports it
  powerpc: Only use -mtraceback=no, -mno-string and -msoft-float if
    toolchain supports it
  powerpc: Don't use -mno-strict-align on clang
  powerpc: Don't use gcc specific options on clang
  llvm: A few Makefile hacks

 Makefile                           |  5 +++++
 arch/powerpc/Makefile              | 14 ++++++++++----
 arch/powerpc/include/asm/uaccess.h |  8 ++++----
 arch/powerpc/lib/Makefile          |  2 +-
 lib/raid6/Makefile                 |  2 +-
 5 files changed, 21 insertions(+), 10 deletions(-)

-- 
2.1.4

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

* [PATCH 1/6] powerpc: Fix duplicate const clang warning in user access code
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  2015-05-25 22:53 ` [PATCH 2/6] powerpc: Only use -mabi=altivec if toolchain supports it Anton Blanchard
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/include/asm/uaccess.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index a0c071d..2a8ebae 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -265,7 +265,7 @@ do {								\
 ({								\
 	long __gu_err;						\
 	unsigned long __gu_val;					\
-	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
+	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	if (!is_kernel_addr((unsigned long)__gu_addr))		\
 		might_fault();					\
@@ -279,7 +279,7 @@ do {								\
 ({								\
 	long __gu_err;						\
 	long long __gu_val;					\
-	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
+	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	if (!is_kernel_addr((unsigned long)__gu_addr))		\
 		might_fault();					\
@@ -293,7 +293,7 @@ do {								\
 ({									\
 	long __gu_err = -EFAULT;					\
 	unsigned long  __gu_val = 0;					\
-	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);		\
+	__typeof__(*(ptr)) __user *__gu_addr = (ptr);		\
 	might_fault();							\
 	if (access_ok(VERIFY_READ, __gu_addr, (size)))			\
 		__get_user_size(__gu_val, __gu_addr, (size), __gu_err);	\
@@ -305,7 +305,7 @@ do {								\
 ({								\
 	long __gu_err;						\
 	unsigned long __gu_val;					\
-	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
+	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	__get_user_size(__gu_val, __gu_addr, (size), __gu_err);	\
 	(x) = (__force __typeof__(*(ptr)))__gu_val;			\
-- 
2.1.4

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

* [PATCH 2/6] powerpc: Only use -mabi=altivec if toolchain supports it
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
  2015-05-25 22:53 ` [PATCH 1/6] powerpc: Fix duplicate const clang warning in user access code Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  2015-05-25 22:53 ` [PATCH 3/6] powerpc: Only use -mtraceback=no, -mno-string and -msoft-float " Anton Blanchard
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

The -mabi=altivec option is not recognised on LLVM, so use call cc-option
to check for support.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/lib/Makefile | 2 +-
 lib/raid6/Makefile        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 7902802..a47e142 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -33,6 +33,6 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
 obj-$(CONFIG_ALTIVEC)	+= xor_vmx.o
-CFLAGS_xor_vmx.o += -maltivec -mabi=altivec
+CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
 
 obj-$(CONFIG_PPC64) += $(obj64-y)
diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile
index c7dab06..3b10a48 100644
--- a/lib/raid6/Makefile
+++ b/lib/raid6/Makefile
@@ -15,7 +15,7 @@ quiet_cmd_unroll = UNROLL  $@
                    < $< > $@ || ( rm -f $@ && exit 1 )
 
 ifeq ($(CONFIG_ALTIVEC),y)
-altivec_flags := -maltivec -mabi=altivec
+altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
 endif
 
 # The GCC option -ffreestanding is required in order to compile code containing
-- 
2.1.4

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

* [PATCH 3/6] powerpc: Only use -mtraceback=no, -mno-string and -msoft-float if toolchain supports it
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
  2015-05-25 22:53 ` [PATCH 1/6] powerpc: Fix duplicate const clang warning in user access code Anton Blanchard
  2015-05-25 22:53 ` [PATCH 2/6] powerpc: Only use -mabi=altivec if toolchain supports it Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  2015-05-25 22:53 ` [PATCH 4/6] powerpc: Don't use -mno-strict-align on clang Anton Blanchard
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

These options are not recognised on LLVM, so use call cc-option to check
for support.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 7a0daad..7c08b4e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -111,7 +111,7 @@ else
 endif
 endif
 
-CFLAGS-$(CONFIG_PPC64)	:= -mtraceback=no
+CFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
 ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,-mcall-aixdesc)
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
@@ -158,7 +158,8 @@ asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
 
 KBUILD_CPPFLAGS	+= -Iarch/$(ARCH) $(asinstr)
 KBUILD_AFLAGS	+= -Iarch/$(ARCH) $(AFLAGS-y)
-KBUILD_CFLAGS	+= -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
+KBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
+KBUILD_CFLAGS	+= -pipe -Iarch/$(ARCH) $(CFLAGS-y)
 CPP		= $(CC) -E $(KBUILD_CFLAGS)
 
 CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
@@ -190,7 +191,7 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
 
 # Never use string load/store instructions as they are
 # often slow when they are implemented at all
-KBUILD_CFLAGS		+= -mno-string
+KBUILD_CFLAGS		+= $(call cc-option,-mno-string)
 
 ifeq ($(CONFIG_6xx),y)
 KBUILD_CFLAGS		+= -mcpu=powerpc
-- 
2.1.4

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

* [PATCH 4/6] powerpc: Don't use -mno-strict-align on clang
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
                   ` (2 preceding siblings ...)
  2015-05-25 22:53 ` [PATCH 3/6] powerpc: Only use -mtraceback=no, -mno-string and -msoft-float " Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  2015-05-25 22:53 ` [PATCH 5/6] powerpc: Don't use gcc specific options " Anton Blanchard
  2015-05-25 22:53 ` [PATCH 6/6] llvm: A few Makefile hacks Anton Blanchard
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

We added -mno-strict-align in commit f036b3681962 (powerpc: Work around little
endian gcc bug) to fix gcc bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57134

Clang doesn't understand it. We need to use a conditional because we can't use the
simpler call cc-option here.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 7c08b4e..9cf7c7c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -65,7 +65,10 @@ endif
 
 
 ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
-override CC	+= -mlittle-endian -mno-strict-align
+override CC	+= -mlittle-endian
+ifneq ($(COMPILER),clang)
+override CC	+= -mno-strict-align
+endif
 override AS	+= -mlittle-endian
 override LD	+= -EL
 override CROSS32CC += -mlittle-endian
-- 
2.1.4

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

* [PATCH 5/6] powerpc: Don't use gcc specific options on clang
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
                   ` (3 preceding siblings ...)
  2015-05-25 22:53 ` [PATCH 4/6] powerpc: Don't use -mno-strict-align on clang Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  2015-05-25 22:53 ` [PATCH 6/6] llvm: A few Makefile hacks Anton Blanchard
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

Add a conditional around the code to select various gcc only options:
-mabi=elfv2 vs -mcall-aixdesc, and -mcmodel=medium vs -mminimal-toc.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9cf7c7c..347c80f6 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -115,6 +115,7 @@ endif
 endif
 
 CFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
+ifneq ($(COMPILER),clang)
 ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,-mcall-aixdesc)
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
@@ -122,6 +123,7 @@ else
 CFLAGS-$(CONFIG_PPC64)	+= -mcall-aixdesc
 endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,-mminimal-toc)
+endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
 CFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 $(MULTIPLEWORD)
 
-- 
2.1.4

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

* [PATCH 6/6] llvm: A few Makefile hacks
  2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
                   ` (4 preceding siblings ...)
  2015-05-25 22:53 ` [PATCH 5/6] powerpc: Don't use gcc specific options " Anton Blanchard
@ 2015-05-25 22:53 ` Anton Blanchard
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2015-05-25 22:53 UTC (permalink / raw)
  To: benh, paulus, mpe, behanw; +Cc: linuxppc-dev

llvm accepts -fno-delete-null-pointer-checks but complains about it.
Wrap it to avoid getting enormous numbers of warnings.

Also add -no-integrated-as to disable the llvm integrated assembler,
lots of stuff currently relies on gas.
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index eae539d..451290f 100644
--- a/Makefile
+++ b/Makefile
@@ -609,7 +609,12 @@ all: vmlinux
 
 include arch/$(SRCARCH)/Makefile
 
+ifneq ($(COMPILER),clang)
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
+endif
+
+KBUILD_CFLAGS  += $(call cc-option,-no-integrated-as,)
+KBUILD_AFLAGS  += $(call cc-option,-no-integrated-as,)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
-- 
2.1.4

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

end of thread, other threads:[~2015-05-25 22:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 22:53 [PATCH 0/6] Build ppc64le kernel with llvm/clang Anton Blanchard
2015-05-25 22:53 ` [PATCH 1/6] powerpc: Fix duplicate const clang warning in user access code Anton Blanchard
2015-05-25 22:53 ` [PATCH 2/6] powerpc: Only use -mabi=altivec if toolchain supports it Anton Blanchard
2015-05-25 22:53 ` [PATCH 3/6] powerpc: Only use -mtraceback=no, -mno-string and -msoft-float " Anton Blanchard
2015-05-25 22:53 ` [PATCH 4/6] powerpc: Don't use -mno-strict-align on clang Anton Blanchard
2015-05-25 22:53 ` [PATCH 5/6] powerpc: Don't use gcc specific options " Anton Blanchard
2015-05-25 22:53 ` [PATCH 6/6] llvm: A few Makefile hacks Anton Blanchard

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