OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | From fb8ffd7cfc68b3dc44e182356a207d784cb30b34 Mon Sep 17 00:00:00 2001 |
2 | From: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||
3 | Date: Thu, 4 Sep 2014 02:40:58 +0900 |
||
4 | Subject: compiler*.h: sync include/linux/compiler*.h with Linux 3.16 |
||
5 | |||
6 | Copy them from Linux v3.16 tag. |
||
7 | My main motivation of this commit is to add compiler-clang.h. |
||
8 | |||
9 | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||
10 | Cc: Jeroen Hofstee <jeroen@myspectrum.nl> |
||
11 | --- |
||
12 | include/linux/compiler-clang.h | 12 ++++++ |
||
13 | include/linux/compiler-gcc.h | 57 ++++++++++++++++++-------- |
||
14 | include/linux/compiler-gcc3.h | 20 ++++----- |
||
15 | include/linux/compiler-gcc4.h | 59 +++++++++++++++++++-------- |
||
16 | include/linux/compiler-intel.h | 40 ++++++++++++++++++ |
||
17 | include/linux/compiler.h | 92 +++++++++++++++++++++++++++++++++++++++++- |
||
18 | 6 files changed, 236 insertions(+), 44 deletions(-) |
||
19 | create mode 100644 include/linux/compiler-clang.h |
||
20 | create mode 100644 include/linux/compiler-intel.h |
||
21 | |||
22 | --- /dev/null |
||
23 | +++ b/include/linux/compiler-clang.h |
||
24 | @@ -0,0 +1,12 @@ |
||
25 | +#ifndef __LINUX_COMPILER_H |
||
26 | +#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead." |
||
27 | +#endif |
||
28 | + |
||
29 | +/* Some compiler specific definitions are overwritten here |
||
30 | + * for Clang compiler |
||
31 | + */ |
||
32 | + |
||
33 | +#ifdef uninitialized_var |
||
34 | +#undef uninitialized_var |
||
35 | +#define uninitialized_var(x) x = *(&(x)) |
||
36 | +#endif |
||
37 | --- a/include/linux/compiler-gcc.h |
||
38 | +++ b/include/linux/compiler-gcc.h |
||
39 | @@ -5,6 +5,9 @@ |
||
40 | /* |
||
41 | * Common definitions for all gcc versions go here. |
||
42 | */ |
||
43 | +#define GCC_VERSION (__GNUC__ * 10000 \ |
||
44 | + + __GNUC_MINOR__ * 100 \ |
||
45 | + + __GNUC_PATCHLEVEL__) |
||
46 | |||
47 | |||
48 | /* Optimization barrier */ |
||
49 | @@ -34,9 +37,15 @@ |
||
50 | __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ |
||
51 | (typeof(ptr)) (__ptr + (off)); }) |
||
52 | |||
53 | +/* Make the optimizer believe the variable can be manipulated arbitrarily. */ |
||
54 | +#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) |
||
55 | + |
||
56 | +#ifdef __CHECKER__ |
||
57 | +#define __must_be_array(arr) 0 |
||
58 | +#else |
||
59 | /* &a[0] degrades to a pointer: a different type from an array */ |
||
60 | -#define __must_be_array(a) \ |
||
61 | - BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
||
62 | +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) |
||
63 | +#endif |
||
64 | |||
65 | /* |
||
66 | * Force always-inline if the user requests it so via the .config, |
||
67 | @@ -44,15 +53,18 @@ |
||
68 | */ |
||
69 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
||
70 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) |
||
71 | -# define inline inline __attribute__((always_inline)) |
||
72 | -# define __inline__ __inline__ __attribute__((always_inline)) |
||
73 | -# define __inline __inline __attribute__((always_inline)) |
||
74 | +# define inline inline __attribute__((always_inline)) notrace |
||
75 | +# define __inline__ __inline__ __attribute__((always_inline)) notrace |
||
76 | +# define __inline __inline __attribute__((always_inline)) notrace |
||
77 | +#else |
||
78 | +/* A lot of inline functions can cause havoc with function tracing */ |
||
79 | +# define inline inline notrace |
||
80 | +# define __inline__ __inline__ notrace |
||
81 | +# define __inline __inline notrace |
||
82 | #endif |
||
83 | |||
84 | #define __deprecated __attribute__((deprecated)) |
||
85 | -#ifndef __packed |
||
86 | -# define __packed __attribute__((packed)) |
||
87 | -#endif |
||
88 | +#define __packed __attribute__((packed)) |
||
89 | #define __weak __attribute__((weak)) |
||
90 | |||
91 | /* |
||
92 | @@ -60,8 +72,12 @@ |
||
93 | * naked functions because then mcount is called without stack and frame pointer |
||
94 | * being set up and there is no chance to restore the lr register to the value |
||
95 | * before mcount was called. |
||
96 | + * |
||
97 | + * The asm() bodies of naked functions often depend on standard calling conventions, |
||
98 | + * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce |
||
99 | + * this, so we must do so ourselves. See GCC PR44290. |
||
100 | */ |
||
101 | -#define __naked __attribute__((naked)) notrace |
||
102 | +#define __naked __attribute__((naked)) noinline __noclone notrace |
||
103 | |||
104 | #define __noreturn __attribute__((noreturn)) |
||
105 | |||
106 | @@ -75,13 +91,10 @@ |
||
107 | * would be. |
||
108 | * [...] |
||
109 | */ |
||
110 | -#ifndef __pure |
||
111 | -# define __pure __attribute__((pure)) |
||
112 | -#endif |
||
113 | -#ifndef __aligned |
||
114 | -# define __aligned(x) __attribute__((aligned(x))) |
||
115 | -#endif |
||
116 | -#define __printf(a,b) __attribute__((format(printf,a,b))) |
||
117 | +#define __pure __attribute__((pure)) |
||
118 | +#define __aligned(x) __attribute__((aligned(x))) |
||
119 | +#define __printf(a, b) __attribute__((format(printf, a, b))) |
||
120 | +#define __scanf(a, b) __attribute__((format(scanf, a, b))) |
||
121 | #define noinline __attribute__((noinline)) |
||
122 | #define __attribute_const__ __attribute__((__const__)) |
||
123 | #define __maybe_unused __attribute__((unused)) |
||
124 | @@ -91,3 +104,15 @@ |
||
125 | #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) |
||
126 | #define gcc_header(x) _gcc_header(x) |
||
127 | #include gcc_header(__GNUC__) |
||
128 | + |
||
129 | +#if !defined(__noclone) |
||
130 | +#define __noclone /* not needed */ |
||
131 | +#endif |
||
132 | + |
||
133 | +/* |
||
134 | + * A trick to suppress uninitialized variable warning without generating any |
||
135 | + * code |
||
136 | + */ |
||
137 | +#define uninitialized_var(x) x = x |
||
138 | + |
||
139 | +#define __always_inline inline __attribute__((always_inline)) |
||
140 | --- a/include/linux/compiler-gcc3.h |
||
141 | +++ b/include/linux/compiler-gcc3.h |
||
142 | @@ -2,20 +2,22 @@ |
||
143 | #error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." |
||
144 | #endif |
||
145 | |||
146 | -#if __GNUC_MINOR__ >= 3 |
||
147 | +#if GCC_VERSION < 30200 |
||
148 | +# error Sorry, your compiler is too old - please upgrade it. |
||
149 | +#endif |
||
150 | + |
||
151 | +#if GCC_VERSION >= 30300 |
||
152 | # define __used __attribute__((__used__)) |
||
153 | #else |
||
154 | # define __used __attribute__((__unused__)) |
||
155 | #endif |
||
156 | |||
157 | -#if __GNUC_MINOR__ >= 4 |
||
158 | +#if GCC_VERSION >= 30400 |
||
159 | #define __must_check __attribute__((warn_unused_result)) |
||
160 | #endif |
||
161 | |||
162 | -/* |
||
163 | - * A trick to suppress uninitialized variable warning without generating any |
||
164 | - * code |
||
165 | - */ |
||
166 | -#define uninitialized_var(x) x = x |
||
167 | - |
||
168 | -#define __always_inline inline __attribute__((always_inline)) |
||
169 | +#ifdef CONFIG_GCOV_KERNEL |
||
170 | +# if GCC_VERSION < 30400 |
||
171 | +# error "GCOV profiling support for gcc versions below 3.4 not included" |
||
172 | +# endif /* __GNUC_MINOR__ */ |
||
173 | +#endif /* CONFIG_GCOV_KERNEL */ |
||
174 | --- a/include/linux/compiler-gcc4.h |
||
175 | +++ b/include/linux/compiler-gcc4.h |
||
176 | @@ -4,7 +4,7 @@ |
||
177 | |||
178 | /* GCC 4.1.[01] miscompiles __weak */ |
||
179 | #ifdef __KERNEL__ |
||
180 | -# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 |
||
181 | +# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 |
||
182 | # error Your version of gcc miscompiles the __weak directive |
||
183 | # endif |
||
184 | #endif |
||
185 | @@ -12,17 +12,12 @@ |
||
186 | #define __used __attribute__((__used__)) |
||
187 | #define __must_check __attribute__((warn_unused_result)) |
||
188 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) |
||
189 | -#ifndef __always_inline |
||
190 | -# define __always_inline inline __attribute__((always_inline)) |
||
191 | -#endif |
||
192 | |||
193 | -/* |
||
194 | - * A trick to suppress uninitialized variable warning without generating any |
||
195 | - * code |
||
196 | - */ |
||
197 | -#define uninitialized_var(x) x = x |
||
198 | +#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 |
||
199 | +# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
||
200 | +#endif |
||
201 | |||
202 | -#if __GNUC_MINOR__ >= 3 |
||
203 | +#if GCC_VERSION >= 40300 |
||
204 | /* Mark functions as cold. gcc will assume any path leading to a call |
||
205 | to them will be unlikely. This means a lot of manual unlikely()s |
||
206 | are unnecessary now for any paths leading to the usual suspects |
||
207 | @@ -38,8 +33,15 @@ |
||
208 | the kernel context */ |
||
209 | #define __cold __attribute__((__cold__)) |
||
210 | |||
211 | +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) |
||
212 | |||
213 | -#if __GNUC_MINOR__ >= 5 |
||
214 | +#ifndef __CHECKER__ |
||
215 | +# define __compiletime_warning(message) __attribute__((warning(message))) |
||
216 | +# define __compiletime_error(message) __attribute__((error(message))) |
||
217 | +#endif /* __CHECKER__ */ |
||
218 | +#endif /* GCC_VERSION >= 40300 */ |
||
219 | + |
||
220 | +#if GCC_VERSION >= 40500 |
||
221 | /* |
||
222 | * Mark a position in code as unreachable. This can be used to |
||
223 | * suppress control flow warnings after asm blocks that transfer |
||
224 | @@ -50,14 +52,37 @@ |
||
225 | * unreleased. Really, we need to have autoconf for the kernel. |
||
226 | */ |
||
227 | #define unreachable() __builtin_unreachable() |
||
228 | -#endif |
||
229 | |||
230 | +/* Mark a function definition as prohibited from being cloned. */ |
||
231 | +#define __noclone __attribute__((__noclone__)) |
||
232 | + |
||
233 | +#endif /* GCC_VERSION >= 40500 */ |
||
234 | + |
||
235 | +#if GCC_VERSION >= 40600 |
||
236 | +/* |
||
237 | + * Tell the optimizer that something else uses this function or variable. |
||
238 | + */ |
||
239 | +#define __visible __attribute__((externally_visible)) |
||
240 | #endif |
||
241 | |||
242 | -#if __GNUC_MINOR__ > 0 |
||
243 | -#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
||
244 | +/* |
||
245 | + * GCC 'asm goto' miscompiles certain code sequences: |
||
246 | + * |
||
247 | + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 |
||
248 | + * |
||
249 | + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. |
||
250 | + * Fixed in GCC 4.8.2 and later versions. |
||
251 | + * |
||
252 | + * (asm goto is automatically volatile - the naming reflects this.) |
||
253 | + */ |
||
254 | +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) |
||
255 | + |
||
256 | +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP |
||
257 | +#if GCC_VERSION >= 40400 |
||
258 | +#define __HAVE_BUILTIN_BSWAP32__ |
||
259 | +#define __HAVE_BUILTIN_BSWAP64__ |
||
260 | #endif |
||
261 | -#if __GNUC_MINOR__ >= 4 |
||
262 | -#define __compiletime_warning(message) __attribute__((warning(message))) |
||
263 | -#define __compiletime_error(message) __attribute__((error(message))) |
||
264 | +#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) |
||
265 | +#define __HAVE_BUILTIN_BSWAP16__ |
||
266 | #endif |
||
267 | +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ |
||
268 | --- /dev/null |
||
269 | +++ b/include/linux/compiler-intel.h |
||
270 | @@ -0,0 +1,40 @@ |
||
271 | +#ifndef __LINUX_COMPILER_H |
||
272 | +#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead." |
||
273 | +#endif |
||
274 | + |
||
275 | +#ifdef __ECC |
||
276 | + |
||
277 | +/* Some compiler specific definitions are overwritten here |
||
278 | + * for Intel ECC compiler |
||
279 | + */ |
||
280 | + |
||
281 | +#include <asm/intrinsics.h> |
||
282 | + |
||
283 | +/* Intel ECC compiler doesn't support gcc specific asm stmts. |
||
284 | + * It uses intrinsics to do the equivalent things. |
||
285 | + */ |
||
286 | +#undef RELOC_HIDE |
||
287 | +#undef OPTIMIZER_HIDE_VAR |
||
288 | + |
||
289 | +#define RELOC_HIDE(ptr, off) \ |
||
290 | + ({ unsigned long __ptr; \ |
||
291 | + __ptr = (unsigned long) (ptr); \ |
||
292 | + (typeof(ptr)) (__ptr + (off)); }) |
||
293 | + |
||
294 | +/* This should act as an optimization barrier on var. |
||
295 | + * Given that this compiler does not have inline assembly, a compiler barrier |
||
296 | + * is the best we can do. |
||
297 | + */ |
||
298 | +#define OPTIMIZER_HIDE_VAR(var) barrier() |
||
299 | + |
||
300 | +/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ |
||
301 | +#define __must_be_array(a) 0 |
||
302 | + |
||
303 | +#endif |
||
304 | + |
||
305 | +#ifndef __HAVE_BUILTIN_BSWAP16__ |
||
306 | +/* icc has this, but it's called _bswap16 */ |
||
307 | +#define __HAVE_BUILTIN_BSWAP16__ |
||
308 | +#define __builtin_bswap16 _bswap16 |
||
309 | +#endif |
||
310 | + |
||
311 | --- a/include/linux/compiler.h |
||
312 | +++ b/include/linux/compiler.h |
||
313 | @@ -5,16 +5,23 @@ |
||
314 | |||
315 | #ifdef __CHECKER__ |
||
316 | # define __user __attribute__((noderef, address_space(1))) |
||
317 | -# define __kernel /* default address space */ |
||
318 | +# define __kernel __attribute__((address_space(0))) |
||
319 | # define __safe __attribute__((safe)) |
||
320 | # define __force __attribute__((force)) |
||
321 | # define __nocast __attribute__((nocast)) |
||
322 | # define __iomem __attribute__((noderef, address_space(2))) |
||
323 | +# define __must_hold(x) __attribute__((context(x,1,1))) |
||
324 | # define __acquires(x) __attribute__((context(x,0,1))) |
||
325 | # define __releases(x) __attribute__((context(x,1,0))) |
||
326 | # define __acquire(x) __context__(x,1) |
||
327 | # define __release(x) __context__(x,-1) |
||
328 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
||
329 | +# define __percpu __attribute__((noderef, address_space(3))) |
||
330 | +#ifdef CONFIG_SPARSE_RCU_POINTER |
||
331 | +# define __rcu __attribute__((noderef, address_space(4))) |
||
332 | +#else |
||
333 | +# define __rcu |
||
334 | +#endif |
||
335 | extern void __chk_user_ptr(const volatile void __user *); |
||
336 | extern void __chk_io_ptr(const volatile void __iomem *); |
||
337 | #else |
||
338 | @@ -27,13 +34,20 @@ extern void __chk_io_ptr(const volatile |
||
339 | # define __chk_user_ptr(x) (void)0 |
||
340 | # define __chk_io_ptr(x) (void)0 |
||
341 | # define __builtin_warning(x, y...) (1) |
||
342 | +# define __must_hold(x) |
||
343 | # define __acquires(x) |
||
344 | # define __releases(x) |
||
345 | # define __acquire(x) (void)0 |
||
346 | # define __release(x) (void)0 |
||
347 | # define __cond_lock(x,c) (c) |
||
348 | +# define __percpu |
||
349 | +# define __rcu |
||
350 | #endif |
||
351 | |||
352 | +/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ |
||
353 | +#define ___PASTE(a,b) a##b |
||
354 | +#define __PASTE(a,b) ___PASTE(a,b) |
||
355 | + |
||
356 | #ifdef __KERNEL__ |
||
357 | |||
358 | #ifdef __GNUC__ |
||
359 | @@ -49,6 +63,13 @@ extern void __chk_io_ptr(const volatile |
||
360 | # include <linux/compiler-intel.h> |
||
361 | #endif |
||
362 | |||
363 | +/* Clang compiler defines __GNUC__. So we will overwrite implementations |
||
364 | + * coming from above header files here |
||
365 | + */ |
||
366 | +#ifdef __clang__ |
||
367 | +#include <linux/compiler-clang.h> |
||
368 | +#endif |
||
369 | + |
||
370 | /* |
||
371 | * Generic compiler-dependent macros required for kernel |
||
372 | * build go below this comment. Actual compiler/compiler version |
||
373 | @@ -156,6 +177,15 @@ void ftrace_likely_update(struct ftrace_ |
||
374 | (typeof(ptr)) (__ptr + (off)); }) |
||
375 | #endif |
||
376 | |||
377 | +#ifndef OPTIMIZER_HIDE_VAR |
||
378 | +#define OPTIMIZER_HIDE_VAR(var) barrier() |
||
379 | +#endif |
||
380 | + |
||
381 | +/* Not-quite-unique ID. */ |
||
382 | +#ifndef __UNIQUE_ID |
||
383 | +# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) |
||
384 | +#endif |
||
385 | + |
||
386 | #endif /* __KERNEL__ */ |
||
387 | |||
388 | #endif /* __ASSEMBLY__ */ |
||
389 | @@ -228,7 +258,7 @@ void ftrace_likely_update(struct ftrace_ |
||
390 | |||
391 | /* |
||
392 | * Rather then using noinline to prevent stack consumption, use |
||
393 | - * noinline_for_stack instead. For documentaiton reasons. |
||
394 | + * noinline_for_stack instead. For documentation reasons. |
||
395 | */ |
||
396 | #define noinline_for_stack noinline |
||
397 | |||
398 | @@ -270,11 +300,20 @@ void ftrace_likely_update(struct ftrace_ |
||
399 | # define __section(S) __attribute__ ((__section__(#S))) |
||
400 | #endif |
||
401 | |||
402 | +#ifndef __visible |
||
403 | +#define __visible |
||
404 | +#endif |
||
405 | + |
||
406 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
||
407 | #ifndef __same_type |
||
408 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
||
409 | #endif |
||
410 | |||
411 | +/* Is this type a native word size -- useful for atomic operations */ |
||
412 | +#ifndef __native_word |
||
413 | +# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) |
||
414 | +#endif |
||
415 | + |
||
416 | /* Compile time object size, -1 for unknown */ |
||
417 | #ifndef __compiletime_object_size |
||
418 | # define __compiletime_object_size(obj) -1 |
||
419 | @@ -284,7 +323,48 @@ void ftrace_likely_update(struct ftrace_ |
||
420 | #endif |
||
421 | #ifndef __compiletime_error |
||
422 | # define __compiletime_error(message) |
||
423 | +/* |
||
424 | + * Sparse complains of variable sized arrays due to the temporary variable in |
||
425 | + * __compiletime_assert. Unfortunately we can't just expand it out to make |
||
426 | + * sparse see a constant array size without breaking compiletime_assert on old |
||
427 | + * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. |
||
428 | + */ |
||
429 | +# ifndef __CHECKER__ |
||
430 | +# define __compiletime_error_fallback(condition) \ |
||
431 | + do { ((void)sizeof(char[1 - 2 * condition])); } while (0) |
||
432 | +# endif |
||
433 | #endif |
||
434 | +#ifndef __compiletime_error_fallback |
||
435 | +# define __compiletime_error_fallback(condition) do { } while (0) |
||
436 | +#endif |
||
437 | + |
||
438 | +#define __compiletime_assert(condition, msg, prefix, suffix) \ |
||
439 | + do { \ |
||
440 | + bool __cond = !(condition); \ |
||
441 | + extern void prefix ## suffix(void) __compiletime_error(msg); \ |
||
442 | + if (__cond) \ |
||
443 | + prefix ## suffix(); \ |
||
444 | + __compiletime_error_fallback(__cond); \ |
||
445 | + } while (0) |
||
446 | + |
||
447 | +#define _compiletime_assert(condition, msg, prefix, suffix) \ |
||
448 | + __compiletime_assert(condition, msg, prefix, suffix) |
||
449 | + |
||
450 | +/** |
||
451 | + * compiletime_assert - break build and emit msg if condition is false |
||
452 | + * @condition: a compile-time constant condition to check |
||
453 | + * @msg: a message to emit if condition is false |
||
454 | + * |
||
455 | + * In tradition of POSIX assert, this macro will break the build if the |
||
456 | + * supplied condition is *false*, emitting the supplied error message if the |
||
457 | + * compiler has support to do so. |
||
458 | + */ |
||
459 | +#define compiletime_assert(condition, msg) \ |
||
460 | + _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) |
||
461 | + |
||
462 | +#define compiletime_assert_atomic_type(t) \ |
||
463 | + compiletime_assert(__native_word(t), \ |
||
464 | + "Need native word sized stores/loads for atomicity.") |
||
465 | |||
466 | /* |
||
467 | * Prevent the compiler from merging or refetching accesses. The compiler |
||
468 | @@ -300,4 +380,12 @@ void ftrace_likely_update(struct ftrace_ |
||
469 | */ |
||
470 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
||
471 | |||
472 | +/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ |
||
473 | +#ifdef CONFIG_KPROBES |
||
474 | +# define __kprobes __attribute__((__section__(".kprobes.text"))) |
||
475 | +# define nokprobe_inline __always_inline |
||
476 | +#else |
||
477 | +# define __kprobes |
||
478 | +# define nokprobe_inline inline |
||
479 | +#endif |
||
480 | #endif /* __LINUX_COMPILER_H */ |