diff options
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r-- | include/linux/compiler.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c8eab637a2a7..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 |