Skip to content

Commit ae596de

Browse files
ojedagregkh
authored andcommitted
Compiler Attributes: naked can be shared
The naked attribute is supported by at least gcc >= 4.6 (for ARM, which is the only current user), gcc >= 8 (for x86), clang >= 3.1 and icc >= 13. See https://godbolt.org/z/350Dyc Therefore, move it out of compiler-gcc.h so that the definition is shared by all compilers. This also fixes Clang support for ARM32 --- 815f0dd ("include/linux/compiler*.h: make compiler-*.h mutually exclusive"). Fixes: 815f0dd ("include/linux/compiler*.h: make compiler-*.h mutually exclusive") Cc: Rasmus Villemoes <[email protected]> Cc: Eli Friedman <[email protected]> Cc: Christopher Li <[email protected]> Cc: Kees Cook <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Joe Perches <[email protected]> Cc: Dominique Martinet <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected] Suggested-by: Arnd Bergmann <[email protected]> Tested-by: Stefan Agner <[email protected]> Reviewed-by: Stefan Agner <[email protected]> Reviewed-by: Luc Van Oostenryck <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d124b44 commit ae596de

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/linux/compiler-gcc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@
7979
#define __noretpoline __attribute__((indirect_branch("keep")))
8080
#endif
8181

82-
/*
83-
* it doesn't make sense on ARM (currently the only user of __naked)
84-
* to trace naked functions because then mcount is called without
85-
* stack and frame pointer being set up and there is no chance to
86-
* restore the lr register to the value before mcount was called.
87-
*/
88-
#define __naked __attribute__((naked)) notrace
89-
9082
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
9183

9284
#define __optimize(level) __attribute__((__optimize__(level)))

include/linux/compiler_types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ struct ftrace_likely_data {
226226
#define notrace __attribute__((no_instrument_function))
227227
#endif
228228

229+
/*
230+
* it doesn't make sense on ARM (currently the only user of __naked)
231+
* to trace naked functions because then mcount is called without
232+
* stack and frame pointer being set up and there is no chance to
233+
* restore the lr register to the value before mcount was called.
234+
*/
235+
#define __naked __attribute__((naked)) notrace
236+
229237
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
230238

231239
/*

0 commit comments

Comments
 (0)