summaryrefslogtreecommitdiff
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-08-28 19:03:57 +0100
committerMark Brown <broonie@kernel.org>2018-08-28 19:03:57 +0100
commit6e2d6b2728fcb408eabd7991804f8cb33ff59f20 (patch)
tree18dc3fc5bd55fa9ff92430e4ab8353de6c5c0e55 /include/linux/compiler.h
parent6f0a256253f48095ba2e5bcdfbed41f21643c105 (diff)
parent5b394b2ddf0347bef56e50c69a58773c94343ff3 (diff)
Merge tag 'v4.19-rc1' into asoc-4.19
Linux 4.19-rc1
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h21
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)
#endif /* __KERNEL__ */
+/*
+ * Force the compiler to emit 'sym' as a symbol, so that we can reference
+ * it from inline assembler. Necessary in case 'sym' could be inlined
+ * otherwise, or eliminated entirely due to lack of references that are
+ * visible to the compiler.
+ */
+#define __ADDRESSABLE(sym) \
+ static void * __attribute__((section(".discard.addressable"), used)) \
+ __PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
+
+/**
+ * offset_to_ptr - convert a relative memory offset to an absolute pointer
+ * @off: the address of the 32-bit offset value
+ */
+static inline void *offset_to_ptr(const int *off)
+{
+ return (void *)((unsigned long)off + *off);
+}
+
#endif /* __ASSEMBLY__ */
#ifndef __optimize
@@ -313,7 +332,7 @@ unsigned long read_word_at_a_time(const void *addr)
#ifdef __OPTIMIZE__
# define __compiletime_assert(condition, msg, prefix, suffix) \
do { \
- bool __cond = !(condition); \
+ int __cond = !(condition); \
extern void prefix ## suffix(void) __compiletime_error(msg); \
if (__cond) \
prefix ## suffix(); \