Re: [PATCH v3 45/64] x86/static_call: Define ELF section entry size of static calls
From: Peter Zijlstra
Date: Fri Jun 27 2025 - 06:51:53 EST
On Thu, Jun 26, 2025 at 04:55:32PM -0700, Josh Poimboeuf wrote:
> In preparation for the objtool klp diff subcommand, define the entry
> size for the .static_call_sites section in its ELF header. This will
> allow tooling to extract individual entries.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> arch/x86/include/asm/static_call.h | 3 ++-
> include/linux/static_call.h | 6 ------
> include/linux/static_call_types.h | 6 ++++++
> kernel/bounds.c | 4 ++++
> tools/include/linux/static_call_types.h | 6 ++++++
> tools/objtool/check.c | 11 +++++++++--
> 6 files changed, 27 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/include/asm/static_call.h b/arch/x86/include/asm/static_call.h
> index 41502bd2afd6..e03ad9bbbf59 100644
> --- a/arch/x86/include/asm/static_call.h
> +++ b/arch/x86/include/asm/static_call.h
> @@ -58,7 +58,8 @@
> ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0)
>
> #define ARCH_ADD_TRAMP_KEY(name) \
> - asm(".pushsection .static_call_tramp_key, \"a\" \n" \
> + asm(".pushsection .static_call_tramp_key, \"aM\", @progbits, " \
> + __stringify(STATIC_CALL_TRAMP_KEY_SIZE) "\n" \
More horrifically confusing indenting.
> ".long " STATIC_CALL_TRAMP_STR(name) " - . \n" \
> ".long " STATIC_CALL_KEY_STR(name) " - . \n" \
> ".popsection \n")