]> www.infradead.org Git - users/dwmw2/linux.git/commit
tools/nolibc: compiler: use attribute((naked)) if available
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 7 Aug 2024 21:51:42 +0000 (23:51 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Mon, 12 Aug 2024 20:22:03 +0000 (22:22 +0200)
commite098eebb63cb1c03813559b5db9da4451ba3a318
treece51a9c0d995c48dd14e2231a5c548e63db8d836
parentef32e9b6a325d1d013b30d898b4dff94082902cd
tools/nolibc: compiler: use attribute((naked)) if available

The current entrypoint attributes optimize("Os", "omit-frame-pointer")
are intended to avoid all compiler generated code, like function
porologue and epilogue.
This is the exact usecase implemented by the attribute "naked".

Unfortunately this is not implemented by GCC for all targets,
so only use it where available.
This also provides compatibility with clang, which recognizes the
"naked" attribute but not the previously used attribute "optimized".

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-6-c20f2f5fc7c2@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/compiler.h