[PATCH 04/15] static_call: Use global functions for the self-test

From: Sami Tolvanen
Date: Fri Apr 16 2021 - 16:39:00 EST


With CONFIG_CFI_CLANG, the compiler renames static functions. This
breaks static_call users using static functions, because the current
implementation assumes functions have stable names by hardcoding them
in inline assembly. Make the self-test functions global to prevent the
compiler from renaming them.

Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
---
kernel/static_call.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/static_call.c b/kernel/static_call.c
index 723fcc9d20db..d09f500c2d2a 100644
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -503,12 +503,12 @@ long __static_call_return0(void)

#ifdef CONFIG_STATIC_CALL_SELFTEST

-static int func_a(int x)
+int func_a(int x)
{
return x+1;
}

-static int func_b(int x)
+int func_b(int x)
{
return x+2;
}
--
2.31.1.368.gbe11c130af-goog