[PATCH] livepatch/klp-build: Require Clang assembler >= 20

Josh Poimboeuf posted 1 patch 1 week, 4 days ago
scripts/livepatch/klp-build | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] livepatch/klp-build: Require Clang assembler >= 20
Posted by Josh Poimboeuf 1 week, 4 days ago
Some special sections specify their ELF section entsize, for example:

  .pushsection section, "M", @progbits, 8

The entsize (8 in this example) is needed by objtool klp-diff for
extracting individual entries.

Clang assembler versions older than 20 silently ignore the above
construct and set entsize to 0, resulting in the following error:

  .discard.annotate_data: missing special section entsize or annotations

Add a klp-build check to prevent the use of Clang assembler versions
prior to 20.

Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules")
Reported-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
For tip/objtool/urgent.

 scripts/livepatch/klp-build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
index a73515a82272..809e198a561d 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -249,6 +249,10 @@ validate_config() {
 	[[ -v CONFIG_GCC_PLUGIN_RANDSTRUCT ]] &&	\
 		die "kernel option 'CONFIG_GCC_PLUGIN_RANDSTRUCT' not supported"
 
+	[[ -v CONFIG_AS_IS_LLVM ]] &&				\
+		[[ "$CONFIG_AS_VERSION" -lt 200000 ]] &&	\
+		die "Clang assembler version < 20 not supported"
+
 	return 0
 }
 
-- 
2.52.0
Re: [PATCH] livepatch/klp-build: Require Clang assembler >= 20
Posted by Song Liu 1 week, 3 days ago
On Tue, Jan 27, 2026 at 5:12 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> Some special sections specify their ELF section entsize, for example:
>
>   .pushsection section, "M", @progbits, 8
>
> The entsize (8 in this example) is needed by objtool klp-diff for
> extracting individual entries.
>
> Clang assembler versions older than 20 silently ignore the above
> construct and set entsize to 0, resulting in the following error:
>
>   .discard.annotate_data: missing special section entsize or annotations
>
> Add a klp-build check to prevent the use of Clang assembler versions
> prior to 20.
>
> Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules")
> Reported-by: Song Liu <song@kernel.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Acked-by: Song Liu <song@kernel.org>