diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 811f7a915658..76e28c229805 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -197,6 +197,17 @@ | |||
197 | #endif | 197 | #endif |
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | #ifdef CONFIG_STACK_VALIDATION | ||
201 | #define annotate_unreachable() ({ \ | ||
202 | asm("%c0:\t\n" \ | ||
203 | ".pushsection __unreachable, \"a\"\t\n" \ | ||
204 | ".long %c0b\t\n" \ | ||
205 | ".popsection\t\n" : : "i" (__LINE__)); \ | ||
206 | }) | ||
207 | #else | ||
208 | #define annotate_unreachable() | ||
209 | #endif | ||
210 | |||
200 | /* | 211 | /* |
201 | * Mark a position in code as unreachable. This can be used to | 212 | * Mark a position in code as unreachable. This can be used to |
202 | * suppress control flow warnings after asm blocks that transfer | 213 | * suppress control flow warnings after asm blocks that transfer |
@@ -206,7 +217,8 @@ | |||
206 | * this in the preprocessor, but we can live with this because they're | 217 | * this in the preprocessor, but we can live with this because they're |
207 | * unreleased. Really, we need to have autoconf for the kernel. | 218 | * unreleased. Really, we need to have autoconf for the kernel. |
208 | */ | 219 | */ |
209 | #define unreachable() __builtin_unreachable() | 220 | #define unreachable() \ |
221 | do { annotate_unreachable(); __builtin_unreachable(); } while (0) | ||
210 | 222 | ||
211 | /* Mark a function definition as prohibited from being cloned. */ | 223 | /* Mark a function definition as prohibited from being cloned. */ |
212 | #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) | 224 | #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) |