diff options
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 42506e4d1f53..681d866efb1e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -280,6 +280,25 @@ unsigned long read_word_at_a_time(const void *addr) | |||
| 280 | 280 | ||
| 281 | #endif /* __KERNEL__ */ | 281 | #endif /* __KERNEL__ */ |
| 282 | 282 | ||
| 283 | /* | ||
| 284 | * Force the compiler to emit 'sym' as a symbol, so that we can reference | ||
| 285 | * it from inline assembler. Necessary in case 'sym' could be inlined | ||
| 286 | * otherwise, or eliminated entirely due to lack of references that are | ||
| 287 | * visible to the compiler. | ||
| 288 | */ | ||
| 289 | #define __ADDRESSABLE(sym) \ | ||
| 290 | static void * __attribute__((section(".discard.addressable"), used)) \ | ||
| 291 | __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; | ||
| 292 | |||
| 293 | /** | ||
| 294 | * offset_to_ptr - convert a relative memory offset to an absolute pointer | ||
| 295 | * @off: the address of the 32-bit offset value | ||
| 296 | */ | ||
| 297 | static inline void *offset_to_ptr(const int *off) | ||
| 298 | { | ||
| 299 | return (void *)((unsigned long)off + *off); | ||
| 300 | } | ||
| 301 | |||
| 283 | #endif /* __ASSEMBLY__ */ | 302 | #endif /* __ASSEMBLY__ */ |
| 284 | 303 | ||
| 285 | #ifndef __optimize | 304 | #ifndef __optimize |
| @@ -313,7 +332,7 @@ unsigned long read_word_at_a_time(const void *addr) | |||
| 313 | #ifdef __OPTIMIZE__ | 332 | #ifdef __OPTIMIZE__ |
| 314 | # define __compiletime_assert(condition, msg, prefix, suffix) \ | 333 | # define __compiletime_assert(condition, msg, prefix, suffix) \ |
| 315 | do { \ | 334 | do { \ |
| 316 | bool __cond = !(condition); \ | 335 | int __cond = !(condition); \ |
| 317 | extern void prefix ## suffix(void) __compiletime_error(msg); \ | 336 | extern void prefix ## suffix(void) __compiletime_error(msg); \ |
| 318 | if (__cond) \ | 337 | if (__cond) \ |
| 319 | prefix ## suffix(); \ | 338 | prefix ## suffix(); \ |
