Thread (23 messages) 23 messages, 5 authors, 2017-12-29

Re: [PATCH v6 2/8] module: use relative references for __ksymtab entries

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2017-12-27 20:07:39
Also in: linux-arm-kernel, linux-mips, lkml, sparclinux

On Wed, Dec 27, 2017 at 12:50 AM, Ard Biesheuvel
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 52e611ab9a6c..fe752d365334 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -327,4 +327,15 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
        compiletime_assert(__native_word(t),                            \
                "Need native word sized stores/loads for atomicity.")

+/*
+ * 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
+ * visibile to the compiler.
+ */
+#define __ADDRESSABLE(sym) \
+       static void *__attribute__((section(".discard.text"), used))    \
+               __PASTE(__discard_##sym, __LINE__)(void)                \
+                       { return (void *)&sym; }                        \
+
 #endif /* __LINUX_COMPILER_H */
Isn't this logically the point where you should add the arm64
vmlinux.lds.S change, and explain how ".discard.text" turns into
".init.discard.text" for some odd arm64 reason?

                   Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help