• Michael Ellerman's avatar
    powerpc: Fix build failure with clang due to BUILD_BUG_ON() · b5fa0f7f
    Michael Ellerman authored
    Anton says: In commit 4db73271 ("powerpc: Add option to use jump
    label for cpu_has_feature()") and commit c12e6f24 ("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: 4db73271 ("powerpc: Add option to use jump label for cpu_has_feature()")
    Fixes: c12e6f24 ("powerpc: Add option to use jump label for mmu_has_feature()")
    Cc: stable@vger.kernel.org # v4.8+
    Reported-by: default avatarAnton Blanchard <anton@samba.org>
    Tested-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    b5fa0f7f
cpu_has_feature.h 1.24 KB