diff options
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 89 |
1 files changed, 87 insertions, 2 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 9f584cc5c5fb..76df771be585 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -9,10 +9,46 @@ | |||
9 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 9 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
10 | #define ALIGN_FUNCTION() . = ALIGN(8) | 10 | #define ALIGN_FUNCTION() . = ALIGN(8) |
11 | 11 | ||
12 | /* The actual configuration determine if the init/exit sections | ||
13 | * are handled as text/data or they can be discarded (which | ||
14 | * often happens at runtime) | ||
15 | */ | ||
16 | #ifdef CONFIG_HOTPLUG | ||
17 | #define DEV_KEEP(sec) *(.dev##sec) | ||
18 | #define DEV_DISCARD(sec) | ||
19 | #else | ||
20 | #define DEV_KEEP(sec) | ||
21 | #define DEV_DISCARD(sec) *(.dev##sec) | ||
22 | #endif | ||
23 | |||
24 | #ifdef CONFIG_HOTPLUG_CPU | ||
25 | #define CPU_KEEP(sec) *(.cpu##sec) | ||
26 | #define CPU_DISCARD(sec) | ||
27 | #else | ||
28 | #define CPU_KEEP(sec) | ||
29 | #define CPU_DISCARD(sec) *(.cpu##sec) | ||
30 | #endif | ||
31 | |||
32 | #if defined(CONFIG_MEMORY_HOTPLUG) | ||
33 | #define MEM_KEEP(sec) *(.mem##sec) | ||
34 | #define MEM_DISCARD(sec) | ||
35 | #else | ||
36 | #define MEM_KEEP(sec) | ||
37 | #define MEM_DISCARD(sec) *(.mem##sec) | ||
38 | #endif | ||
39 | |||
40 | |||
12 | /* .data section */ | 41 | /* .data section */ |
13 | #define DATA_DATA \ | 42 | #define DATA_DATA \ |
14 | *(.data) \ | 43 | *(.data) \ |
15 | *(.data.init.refok) \ | 44 | *(.data.init.refok) \ |
45 | *(.ref.data) \ | ||
46 | DEV_KEEP(init.data) \ | ||
47 | DEV_KEEP(exit.data) \ | ||
48 | CPU_KEEP(init.data) \ | ||
49 | CPU_KEEP(exit.data) \ | ||
50 | MEM_KEEP(init.data) \ | ||
51 | MEM_KEEP(exit.data) \ | ||
16 | . = ALIGN(8); \ | 52 | . = ALIGN(8); \ |
17 | VMLINUX_SYMBOL(__start___markers) = .; \ | 53 | VMLINUX_SYMBOL(__start___markers) = .; \ |
18 | *(__markers) \ | 54 | *(__markers) \ |
@@ -132,6 +168,17 @@ | |||
132 | *(__ksymtab_strings) \ | 168 | *(__ksymtab_strings) \ |
133 | } \ | 169 | } \ |
134 | \ | 170 | \ |
171 | /* __*init sections */ \ | ||
172 | __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ | ||
173 | *(.ref.rodata) \ | ||
174 | DEV_KEEP(init.rodata) \ | ||
175 | DEV_KEEP(exit.rodata) \ | ||
176 | CPU_KEEP(init.rodata) \ | ||
177 | CPU_KEEP(exit.rodata) \ | ||
178 | MEM_KEEP(init.rodata) \ | ||
179 | MEM_KEEP(exit.rodata) \ | ||
180 | } \ | ||
181 | \ | ||
135 | /* Built-in module parameters. */ \ | 182 | /* Built-in module parameters. */ \ |
136 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ | 183 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ |
137 | VMLINUX_SYMBOL(__start___param) = .; \ | 184 | VMLINUX_SYMBOL(__start___param) = .; \ |
@@ -139,7 +186,6 @@ | |||
139 | VMLINUX_SYMBOL(__stop___param) = .; \ | 186 | VMLINUX_SYMBOL(__stop___param) = .; \ |
140 | VMLINUX_SYMBOL(__end_rodata) = .; \ | 187 | VMLINUX_SYMBOL(__end_rodata) = .; \ |
141 | } \ | 188 | } \ |
142 | \ | ||
143 | . = ALIGN((align)); | 189 | . = ALIGN((align)); |
144 | 190 | ||
145 | /* RODATA provided for backward compatibility. | 191 | /* RODATA provided for backward compatibility. |
@@ -158,8 +204,16 @@ | |||
158 | #define TEXT_TEXT \ | 204 | #define TEXT_TEXT \ |
159 | ALIGN_FUNCTION(); \ | 205 | ALIGN_FUNCTION(); \ |
160 | *(.text) \ | 206 | *(.text) \ |
207 | *(.ref.text) \ | ||
161 | *(.text.init.refok) \ | 208 | *(.text.init.refok) \ |
162 | *(.exit.text.refok) | 209 | *(.exit.text.refok) \ |
210 | DEV_KEEP(init.text) \ | ||
211 | DEV_KEEP(exit.text) \ | ||
212 | CPU_KEEP(init.text) \ | ||
213 | CPU_KEEP(exit.text) \ | ||
214 | MEM_KEEP(init.text) \ | ||
215 | MEM_KEEP(exit.text) | ||
216 | |||
163 | 217 | ||
164 | /* sched.text is aling to function alignment to secure we have same | 218 | /* sched.text is aling to function alignment to secure we have same |
165 | * address even at second ld pass when generating System.map */ | 219 | * address even at second ld pass when generating System.map */ |
@@ -183,6 +237,37 @@ | |||
183 | *(.kprobes.text) \ | 237 | *(.kprobes.text) \ |
184 | VMLINUX_SYMBOL(__kprobes_text_end) = .; | 238 | VMLINUX_SYMBOL(__kprobes_text_end) = .; |
185 | 239 | ||
240 | /* init and exit section handling */ | ||
241 | #define INIT_DATA \ | ||
242 | *(.init.data) \ | ||
243 | DEV_DISCARD(init.data) \ | ||
244 | DEV_DISCARD(init.rodata) \ | ||
245 | CPU_DISCARD(init.data) \ | ||
246 | CPU_DISCARD(init.rodata) \ | ||
247 | MEM_DISCARD(init.data) \ | ||
248 | MEM_DISCARD(init.rodata) | ||
249 | |||
250 | #define INIT_TEXT \ | ||
251 | *(.init.text) \ | ||
252 | DEV_DISCARD(init.text) \ | ||
253 | CPU_DISCARD(init.text) \ | ||
254 | MEM_DISCARD(init.text) | ||
255 | |||
256 | #define EXIT_DATA \ | ||
257 | *(.exit.data) \ | ||
258 | DEV_DISCARD(exit.data) \ | ||
259 | DEV_DISCARD(exit.rodata) \ | ||
260 | CPU_DISCARD(exit.data) \ | ||
261 | CPU_DISCARD(exit.rodata) \ | ||
262 | MEM_DISCARD(exit.data) \ | ||
263 | MEM_DISCARD(exit.rodata) | ||
264 | |||
265 | #define EXIT_TEXT \ | ||
266 | *(.exit.text) \ | ||
267 | DEV_DISCARD(exit.text) \ | ||
268 | CPU_DISCARD(exit.text) \ | ||
269 | MEM_DISCARD(exit.text) | ||
270 | |||
186 | /* DWARF debug sections. | 271 | /* DWARF debug sections. |
187 | Symbols in the DWARF debugging sections are relative to | 272 | Symbols in the DWARF debugging sections are relative to |
188 | the beginning of the section so we begin them at 0. */ | 273 | the beginning of the section so we begin them at 0. */ |