linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	ardb@kernel.org, james.morse@arm.com, joey.gouly@arm.com,
	nathan@kernel.org, will@kernel.org
Subject: Re: [PATCH] arm64: avoid BUILD_BUG_ON() in alternative-macros
Date: Tue, 20 Sep 2022 16:48:20 +0100	[thread overview]
Message-ID: <875yhikpx7.wl-maz@kernel.org> (raw)
In-Reply-To: <20220920140044.1709073-1-mark.rutland@arm.com>

On Tue, 20 Sep 2022 15:00:44 +0100,
Mark Rutland <mark.rutland@arm.com> wrote:
> 
> Nathan reports that the build fails when using clang and LTO:
> 
> |  In file included from kernel/bounds.c:10:
> |  In file included from ./include/linux/page-flags.h:10:
> |  In file included from ./include/linux/bug.h:5:
> |  In file included from ./arch/arm64/include/asm/bug.h:26:
> |  In file included from ./include/asm-generic/bug.h:5:
> |  In file included from ./include/linux/compiler.h:248:
> |  In file included from ./arch/arm64/include/asm/rwonce.h:11:
> |  ./arch/arm64/include/asm/alternative-macros.h:224:2: error: call to undeclared function 'BUILD_BUG_ON'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> |          BUILD_BUG_ON(feature >= ARM64_NCAPS);
> |          ^
> |  ./arch/arm64/include/asm/alternative-macros.h:241:2: error: call to undeclared function 'BUILD_BUG_ON'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> |          BUILD_BUG_ON(feature >= ARM64_NCAPS);
> |          ^
> |  2 errors generated.
> 
> ... the problem being that when LTO is enabled, <asm/rwonce.h> includes
> <asm/alternative-macros.h>, and causes a circular include dependency
> through <linux/bug.h>. This manifests as BUILD_BUG_ON() not being
> defined when used within <asm/alternative-macros.h>.
> 
> This patch avoids the problem and simplifies the include dependencies by
> using compiletime_assert() instead of BUILD_BUG_ON().
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Fixes: 21fb26bfb01ffe0d ("arm64: alternatives: add alternative_has_feature_*()")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Tested-by: Nathan Chancellor <nathan@kernel.org>
> Link: http://lore.kernel.org/r/YyigTrxhE3IRPzjs@dev-arch.thelio-3990X
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Cc: Joey Gouly <joey.gouly@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> ---
>  arch/arm64/include/asm/alternative-macros.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-09-20 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 14:00 [PATCH] arm64: avoid BUILD_BUG_ON() in alternative-macros Mark Rutland
2022-09-20 14:53 ` Ard Biesheuvel
2022-09-20 15:48 ` Marc Zyngier [this message]
2022-09-21 12:04 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yhikpx7.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=nathan@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).