diff options
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 06396c1cf127..fc5004a4b07d 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -99,13 +99,22 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, | |||
| 99 | * unique, to convince GCC not to merge duplicate inline asm statements. | 99 | * unique, to convince GCC not to merge duplicate inline asm statements. |
| 100 | */ | 100 | */ |
| 101 | #define annotate_reachable() ({ \ | 101 | #define annotate_reachable() ({ \ |
| 102 | asm volatile("ANNOTATE_REACHABLE counter=%c0" \ | 102 | asm volatile("%c0:\n\t" \ |
| 103 | : : "i" (__COUNTER__)); \ | 103 | ".pushsection .discard.reachable\n\t" \ |
| 104 | ".long %c0b - .\n\t" \ | ||
| 105 | ".popsection\n\t" : : "i" (__COUNTER__)); \ | ||
| 104 | }) | 106 | }) |
| 105 | #define annotate_unreachable() ({ \ | 107 | #define annotate_unreachable() ({ \ |
| 106 | asm volatile("ANNOTATE_UNREACHABLE counter=%c0" \ | 108 | asm volatile("%c0:\n\t" \ |
| 107 | : : "i" (__COUNTER__)); \ | 109 | ".pushsection .discard.unreachable\n\t" \ |
| 110 | ".long %c0b - .\n\t" \ | ||
| 111 | ".popsection\n\t" : : "i" (__COUNTER__)); \ | ||
| 108 | }) | 112 | }) |
| 113 | #define ASM_UNREACHABLE \ | ||
| 114 | "999:\n\t" \ | ||
| 115 | ".pushsection .discard.unreachable\n\t" \ | ||
| 116 | ".long 999b - .\n\t" \ | ||
| 117 | ".popsection\n\t" | ||
| 109 | #else | 118 | #else |
| 110 | #define annotate_reachable() | 119 | #define annotate_reachable() |
| 111 | #define annotate_unreachable() | 120 | #define annotate_unreachable() |
| @@ -293,45 +302,6 @@ static inline void *offset_to_ptr(const int *off) | |||
| 293 | return (void *)((unsigned long)off + *off); | 302 | return (void *)((unsigned long)off + *off); |
| 294 | } | 303 | } |
| 295 | 304 | ||
| 296 | #else /* __ASSEMBLY__ */ | ||
| 297 | |||
| 298 | #ifdef __KERNEL__ | ||
| 299 | #ifndef LINKER_SCRIPT | ||
| 300 | |||
| 301 | #ifdef CONFIG_STACK_VALIDATION | ||
| 302 | .macro ANNOTATE_UNREACHABLE counter:req | ||
| 303 | \counter: | ||
| 304 | .pushsection .discard.unreachable | ||
| 305 | .long \counter\()b -. | ||
| 306 | .popsection | ||
| 307 | .endm | ||
| 308 | |||
| 309 | .macro ANNOTATE_REACHABLE counter:req | ||
| 310 | \counter: | ||
| 311 | .pushsection .discard.reachable | ||
| 312 | .long \counter\()b -. | ||
| 313 | .popsection | ||
| 314 | .endm | ||
| 315 | |||
| 316 | .macro ASM_UNREACHABLE | ||
| 317 | 999: | ||
| 318 | .pushsection .discard.unreachable | ||
| 319 | .long 999b - . | ||
| 320 | .popsection | ||
| 321 | .endm | ||
| 322 | #else /* CONFIG_STACK_VALIDATION */ | ||
| 323 | .macro ANNOTATE_UNREACHABLE counter:req | ||
| 324 | .endm | ||
| 325 | |||
| 326 | .macro ANNOTATE_REACHABLE counter:req | ||
| 327 | .endm | ||
| 328 | |||
| 329 | .macro ASM_UNREACHABLE | ||
| 330 | .endm | ||
| 331 | #endif /* CONFIG_STACK_VALIDATION */ | ||
| 332 | |||
| 333 | #endif /* LINKER_SCRIPT */ | ||
| 334 | #endif /* __KERNEL__ */ | ||
| 335 | #endif /* __ASSEMBLY__ */ | 305 | #endif /* __ASSEMBLY__ */ |
| 336 | 306 | ||
| 337 | /* Compile time object size, -1 for unknown */ | 307 | /* Compile time object size, -1 for unknown */ |
