All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "powerpc: Fix build failure with clang due to BUILD_BUG_ON()" has been added to the 4.9-stable tree
@ 2017-02-04 10:22 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-02-04 10:22 UTC (permalink / raw)
  To: mpe, anton, gregkh, naveen.n.rao; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    powerpc: Fix build failure with clang due to BUILD_BUG_ON()

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-fix-build-failure-with-clang-due-to-build_bug_on.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From b5fa0f7f88edcde37df1807fdf9ff10ec787a60e Mon Sep 17 00:00:00 2001
From: Michael Ellerman <mpe@ellerman.id.au>
Date: Tue, 24 Jan 2017 16:36:57 +1100
Subject: powerpc: Fix build failure with clang due to BUILD_BUG_ON()

From: Michael Ellerman <mpe@ellerman.id.au>

commit b5fa0f7f88edcde37df1807fdf9ff10ec787a60e upstream.

Anton says: In commit 4db7327194db ("powerpc: Add option to use jump
label for cpu_has_feature()") and commit c12e6f24d413 ("powerpc: Add
option to use jump label for mmu_has_feature()") we added:

  BUILD_BUG_ON(!__builtin_constant_p(feature))

to cpu_has_feature() and mmu_has_feature() in order to catch usage
issues (such as cpu_has_feature(cpu_has_feature(X), which has happened
once in the past). Unfortunately LLVM isn't smart enough to resolve
this, and it errors out.

I work around it in my clang/LLVM builds of the kernel, but I have just
discovered that it causes a lot of issues for the bcc (eBPF) trace tool
(which uses LLVM).

For now just #ifdef it away for clang builds.

Fixes: 4db7327194db ("powerpc: Add option to use jump label for cpu_has_feature()")
Fixes: c12e6f24d413 ("powerpc: Add option to use jump label for mmu_has_feature()")
Reported-by: Anton Blanchard <anton@samba.org>
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/cpu_has_feature.h |    2 ++
 arch/powerpc/include/asm/mmu.h             |    2 ++
 2 files changed, 4 insertions(+)

--- a/arch/powerpc/include/asm/cpu_has_feature.h
+++ b/arch/powerpc/include/asm/cpu_has_feature.h
@@ -23,7 +23,9 @@ static __always_inline bool cpu_has_feat
 {
 	int i;
 
+#ifndef __clang__ /* clang can't cope with this */
 	BUILD_BUG_ON(!__builtin_constant_p(feature));
+#endif
 
 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
 	if (!static_key_initialized) {
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -160,7 +160,9 @@ static __always_inline bool mmu_has_feat
 {
 	int i;
 
+#ifndef __clang__ /* clang can't cope with this */
 	BUILD_BUG_ON(!__builtin_constant_p(feature));
+#endif
 
 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
 	if (!static_key_initialized) {


Patches currently in stable-queue which might be from mpe@ellerman.id.au are

queue-4.9/powerpc-fix-build-failure-with-clang-due-to-build_bug_on.patch
queue-4.9/powerpc-mm-use-the-correct-pointer-when-setting-a-2mb-pte.patch
queue-4.9/powerpc-eeh-fix-wrong-flag-passed-to-eeh_unfreeze_pe.patch
queue-4.9/powerpc-add-missing-error-check-to-prom_find_boot_cpu.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-04 10:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-04 10:22 Patch "powerpc: Fix build failure with clang due to BUILD_BUG_ON()" has been added to the 4.9-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.