Files
linux-stable-mirror/arch/arm64/kernel/static_call.c
T
Arnd BergmannandWill Deacon 998d4d789d arm64: static_call: include asm/insns.h
I came a cross a missing declaration in a randconfig build:

arch/arm64/kernel/static_call.c:16:5: error: call to undeclared function 'aarch64_insn_adrp_get_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   16 |                   aarch64_insn_adrp_get_offset(le32_to_cpup(tramp + 4)) +
      |                   ^

Include the header that contains this definition explicitly,
rather than relying on it to come indirectly through another
header.

Fixes: 54ac9ff8f1 ("arm64: Use static call trampolines when kCFI is enabled")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Will Deacon <will@kernel.org>
2026-06-19 15:27:33 +01:00

25 lines
701 B
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/static_call.h>
#include <linux/memory.h>
#include <asm/text-patching.h>
#include <asm/insn.h>
void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
{
u64 literal;
int ret;
if (!func)
func = __static_call_return0;
/* decode the instructions to discover the literal address */
literal = ALIGN_DOWN((u64)tramp + 4, SZ_4K) +
aarch64_insn_adrp_get_offset(le32_to_cpup(tramp + 4)) +
8 * aarch64_insn_decode_immediate(AARCH64_INSN_IMM_12,
le32_to_cpup(tramp + 8));
ret = aarch64_insn_write_literal_u64((void *)literal, (u64)func);
WARN_ON_ONCE(ret);
}
EXPORT_SYMBOL_GPL(arch_static_call_transform);