[RFC 24/31] objtool: Make STACK_FRAME_NON_STANDARD consistent

Josh Poimboeuf
2024-09-03T04:00:41Z

The C version of STACK_FRAME_NON_STANDARD differs from its asm
counterpart:

- it uses an 8-byte entry (vs 4-byte)
- it creates a superfluous temporary variable

Make it identical to the asm version.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
include/linux/objtool.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/objtool.h b/include/linux/objtool.h
index b3b8d3dab52d..5e66b6d26df5 100644
--- a/include/linux/objtool.h
+++ b/include/linux/objtool.h
@@ -30,9 +30,10 @@
*
* For more information, see tools/objtool/Documentation/objtool.txt.
*/
-#define STACK_FRAME_NON_STANDARD(func) \
- static void __used __section(".discard.func_stack_frame_non_standard") \
- *__func_stack_frame_non_standard_##func = func
+#define STACK_FRAME_NON_STANDARD(func) \
+ asm(".pushsection .discard.func_stack_frame_non_standard, \"aw\"\n\t" \
+ ".long " __stringify(func) " - .\n\t" \
+ ".popsection")

/*
* STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore
--
2.45.2