aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2017-01-24 00:36:57 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-09 02:08:27 -0500
commit8f415333be3a448d9db57a9142fde7efe863432d (patch)
treeb34d6fe6a56d48ab7f5058062922725a4cf07442
parentbbf69e5197daf5560fa37894e50d943b2065496c (diff)
powerpc: Fix build failure with clang due to BUILD_BUG_ON()
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>
-rw-r--r--arch/powerpc/include/asm/cpu_has_feature.h2
-rw-r--r--arch/powerpc/include/asm/mmu.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h
index b312b152461b..6e834caa3720 100644
--- 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_feature(unsigned long feature)
23{ 23{
24 int i; 24 int i;
25 25
26#ifndef __clang__ /* clang can't cope with this */
26 BUILD_BUG_ON(!__builtin_constant_p(feature)); 27 BUILD_BUG_ON(!__builtin_constant_p(feature));
28#endif
27 29
28#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG 30#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
29 if (!static_key_initialized) { 31 if (!static_key_initialized) {
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index e311c25751a4..a244e09d2d88 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -160,7 +160,9 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
160{ 160{
161 int i; 161 int i;
162 162
163#ifndef __clang__ /* clang can't cope with this */
163 BUILD_BUG_ON(!__builtin_constant_p(feature)); 164 BUILD_BUG_ON(!__builtin_constant_p(feature));
165#endif
164 166
165#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG 167#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
166 if (!static_key_initialized) { 168 if (!static_key_initialized) {