diff options
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r-- | include/linux/compiler.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 043b60de041e..e786337cf5a7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -185,8 +185,34 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, | |||
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | /* Unreachable code */ | 187 | /* Unreachable code */ |
188 | #ifdef CONFIG_STACK_VALIDATION | ||
189 | #define annotate_reachable() ({ \ | ||
190 | asm("%c0:\n\t" \ | ||
191 | ".pushsection .discard.reachable\n\t" \ | ||
192 | ".long %c0b - .\n\t" \ | ||
193 | ".popsection\n\t" : : "i" (__LINE__)); \ | ||
194 | }) | ||
195 | #define annotate_unreachable() ({ \ | ||
196 | asm("%c0:\n\t" \ | ||
197 | ".pushsection .discard.unreachable\n\t" \ | ||
198 | ".long %c0b - .\n\t" \ | ||
199 | ".popsection\n\t" : : "i" (__LINE__)); \ | ||
200 | }) | ||
201 | #define ASM_UNREACHABLE \ | ||
202 | "999:\n\t" \ | ||
203 | ".pushsection .discard.unreachable\n\t" \ | ||
204 | ".long 999b - .\n\t" \ | ||
205 | ".popsection\n\t" | ||
206 | #else | ||
207 | #define annotate_reachable() | ||
208 | #define annotate_unreachable() | ||
209 | #endif | ||
210 | |||
211 | #ifndef ASM_UNREACHABLE | ||
212 | # define ASM_UNREACHABLE | ||
213 | #endif | ||
188 | #ifndef unreachable | 214 | #ifndef unreachable |
189 | # define unreachable() do { } while (1) | 215 | # define unreachable() do { annotate_reachable(); do { } while (1); } while (0) |
190 | #endif | 216 | #endif |
191 | 217 | ||
192 | /* | 218 | /* |