aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-01-28 14:21:15 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:21:19 -0500
commit312b1485fb509c9bc32eda28ad29537896658cb8 (patch)
tree875ad50025dd230e7097a46cbab4e1a57a3696e1
parente241a630374e06aecdae2884af8b652d3b4d6c37 (diff)
Introduce new section reference annotations tags: __ref, __refdata, __refconst
Today we have the following annotations for functions/data referencing __init/__exit functions / data: __init_refok => for init functions __initdata_refok => for init data __exit_refok => for exit functions There is really no difference between the __init and __exit versions and simplify it and to introduce a shorter annotation the following new annotations are introduced: __ref => for functions (code) that references __*init / __*exit __refdata => for variables __refconst => for const variables Whit this annotation is it more obvious what the annotation is for and there is no longer the arbitary division between __init and __exit code. The mechanishm is the same as before - a special section is created which is made part of the usual sections in the linker script. We will start to see annotations like this: -static struct pci_serial_quirk pci_serial_quirks[] = { +static const struct pci_serial_quirk pci_serial_quirks[] __refconst = { ----------------- -static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = +static struct notifier_block cpuid_class_cpu_notifier __refdata = ---------------- -static int threshold_cpu_callback(struct notifier_block *nfb, +static int __ref threshold_cpu_callback(struct notifier_block *nfb, [The above is just random samples]. Note: No modifications were needed in modpost to support the new sections due to the newly introduced blacklisting. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-rw-r--r--include/linux/init.h34
2 files changed, 30 insertions, 7 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 294853053707..76df771be585 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -42,6 +42,7 @@
42#define DATA_DATA \ 42#define DATA_DATA \
43 *(.data) \ 43 *(.data) \
44 *(.data.init.refok) \ 44 *(.data.init.refok) \
45 *(.ref.data) \
45 DEV_KEEP(init.data) \ 46 DEV_KEEP(init.data) \
46 DEV_KEEP(exit.data) \ 47 DEV_KEEP(exit.data) \
47 CPU_KEEP(init.data) \ 48 CPU_KEEP(init.data) \
@@ -169,6 +170,7 @@
169 \ 170 \
170 /* __*init sections */ \ 171 /* __*init sections */ \
171 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ 172 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
173 *(.ref.rodata) \
172 DEV_KEEP(init.rodata) \ 174 DEV_KEEP(init.rodata) \
173 DEV_KEEP(exit.rodata) \ 175 DEV_KEEP(exit.rodata) \
174 CPU_KEEP(init.rodata) \ 176 CPU_KEEP(init.rodata) \
@@ -202,6 +204,7 @@
202#define TEXT_TEXT \ 204#define TEXT_TEXT \
203 ALIGN_FUNCTION(); \ 205 ALIGN_FUNCTION(); \
204 *(.text) \ 206 *(.text) \
207 *(.ref.text) \
205 *(.text.init.refok) \ 208 *(.text.init.refok) \
206 *(.exit.text.refok) \ 209 *(.exit.text.refok) \
207 DEV_KEEP(init.text) \ 210 DEV_KEEP(init.text) \
diff --git a/include/linux/init.h b/include/linux/init.h
index dde1eaa7766b..2efbda016741 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -52,12 +52,26 @@
52 * when early init has completed so all such references are potential bugs. 52 * when early init has completed so all such references are potential bugs.
53 * For exit sections the same issue exists. 53 * For exit sections the same issue exists.
54 * The following markers are used for the cases where the reference to 54 * The following markers are used for the cases where the reference to
55 * the init/exit section (code or data) is valid and will teach modpost 55 * the *init / *exit section (code or data) is valid and will teach
56 * not to issue a warning. 56 * modpost not to issue a warning.
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __section(.text.init.refok) 58#define __ref __section(.ref.text) noinline
59#define __initdata_refok __section(.data.init.refok) 59#define __refdata __section(.ref.data)
60#define __exit_refok noinline __section(.exit.text.refok) 60#define __refconst __section(.ref.rodata)
61
62/* backward compatibility note
63 * A few places hardcode the old section names:
64 * .text.init.refok
65 * .data.init.refok
66 * .exit.text.refok
67 * They should be converted to use the defines from this file
68 */
69
70/* compatibility defines */
71#define __init_refok __ref
72#define __initdata_refok __refdata
73#define __exit_refok __ref
74
61 75
62#ifdef MODULE 76#ifdef MODULE
63#define __exitused 77#define __exitused
@@ -93,11 +107,9 @@
93 107
94/* For assembly routines */ 108/* For assembly routines */
95#define __INIT .section ".init.text","ax" 109#define __INIT .section ".init.text","ax"
96#define __INIT_REFOK .section ".text.init.refok","ax"
97#define __FINIT .previous 110#define __FINIT .previous
98 111
99#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
100#define __INITDATA_REFOK .section ".data.init.refok","aw"
101 113
102#define __DEVINIT .section ".devinit.text", "ax" 114#define __DEVINIT .section ".devinit.text", "ax"
103#define __DEVINITDATA .section ".devinit.data", "aw" 115#define __DEVINITDATA .section ".devinit.data", "aw"
@@ -108,6 +120,14 @@
108#define __MEMINIT .section ".meminit.text", "ax" 120#define __MEMINIT .section ".meminit.text", "ax"
109#define __MEMINITDATA .section ".meminit.data", "aw" 121#define __MEMINITDATA .section ".meminit.data", "aw"
110 122
123/* silence warnings when references are OK */
124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
130
111#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
112/* 132/*
113 * Used for initialization calls.. 133 * Used for initialization calls..