diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 2 | ||||
-rw-r--r-- | include/linux/compiler-gcc.h | 14 | ||||
-rw-r--r-- | include/linux/compiler.h | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 0968d13b3885..4e09b28b0a7b 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -551,6 +551,7 @@ MEM_DISCARD(init.data) \ KERNEL_CTORS() \ MCOUNT_REC() \ + *(.init.rodata.str) \ *(.init.rodata) \ FTRACE_EVENTS() \ TRACE_SYSCALLS() \ @@ -579,6 +580,7 @@ *(.fini_array) \ *(.dtors) \ MEM_DISCARD(exit.data) \ + *(.exit.rodata.str) \ MEM_DISCARD(exit.rodata) #define EXIT_TEXT \ diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0444b1336268..cd4e9ffb00a7 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -196,6 +196,20 @@ #endif /* + * The initify gcc-plugin attempts to identify const arguments that are only + * used during init (see __init and __exit), so they can be moved to the + * .init.rodata/.exit.rodata section. If an argument is passed to a non-init + * function, it must normally be assumed that such an argument has been + * captured by that function and may be used in the future when .init/.exit has + * been unmapped from memory. In order to identify functions that are confirmed + * to not capture their arguments, the __nocapture() attribute is used so that + * initify can better identify candidate variables. + */ +#ifdef INITIFY_PLUGIN +#define __nocapture(...) __attribute__((nocapture(__VA_ARGS__))) +#endif + +/* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer * control elsewhere. diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 91c30cba984e..fe0931b0532a 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -437,6 +437,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s # define __latent_entropy #endif +#ifndef __nocapture +# define __nocapture(...) +#endif + /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. |