xref: /linux/include/asm-generic/vmlinux.lds.h (revision a0b54e256d513ed99e456bea6e4e188ff92e7c46)
1 /*
2  * Helper macros to support writing architecture specific
3  * linker scripts.
4  *
5  * A minimal linker scripts has following content:
6  * [This is a sample, architectures may have special requiriements]
7  *
8  * OUTPUT_FORMAT(...)
9  * OUTPUT_ARCH(...)
10  * ENTRY(...)
11  * SECTIONS
12  * {
13  *	. = START;
14  *	__init_begin = .;
15  *	HEAD_TEXT_SECTION
16  *	INIT_TEXT_SECTION(PAGE_SIZE)
17  *	INIT_DATA_SECTION(...)
18  *	PERCPU(PAGE_SIZE)
19  *	__init_end = .;
20  *
21  *	_stext = .;
22  *	TEXT_SECTION = 0
23  *	_etext = .;
24  *
25  *      _sdata = .;
26  *	RO_DATA_SECTION(PAGE_SIZE)
27  *	RW_DATA_SECTION(...)
28  *	_edata = .;
29  *
30  *	EXCEPTION_TABLE(...)
31  *	NOTES
32  *
33  *	BSS_SECTION(0, 0, 0)
34  *	_end = .;
35  *
36  *	STABS_DEBUG
37  *	DWARF_DEBUG
38  *
39  *	DISCARDS		// must be the last
40  * }
41  *
42  * [__init_begin, __init_end] is the init section that may be freed after init
43  * [_stext, _etext] is the text section
44  * [_sdata, _edata] is the data section
45  *
46  * Some of the included output section have their own set of constants.
47  * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
48  *               [__nosave_begin, __nosave_end] for the nosave data
49  */
50 
51 #ifndef LOAD_OFFSET
52 #define LOAD_OFFSET 0
53 #endif
54 
55 #ifndef VMLINUX_SYMBOL
56 #define VMLINUX_SYMBOL(_sym_) _sym_
57 #endif
58 
59 /* Align . to a 8 byte boundary equals to maximum function alignment. */
60 #define ALIGN_FUNCTION()  . = ALIGN(8)
61 
62 /* The actual configuration determine if the init/exit sections
63  * are handled as text/data or they can be discarded (which
64  * often happens at runtime)
65  */
66 #ifdef CONFIG_HOTPLUG
67 #define DEV_KEEP(sec)    *(.dev##sec)
68 #define DEV_DISCARD(sec)
69 #else
70 #define DEV_KEEP(sec)
71 #define DEV_DISCARD(sec) *(.dev##sec)
72 #endif
73 
74 #ifdef CONFIG_HOTPLUG_CPU
75 #define CPU_KEEP(sec)    *(.cpu##sec)
76 #define CPU_DISCARD(sec)
77 #else
78 #define CPU_KEEP(sec)
79 #define CPU_DISCARD(sec) *(.cpu##sec)
80 #endif
81 
82 #if defined(CONFIG_MEMORY_HOTPLUG)
83 #define MEM_KEEP(sec)    *(.mem##sec)
84 #define MEM_DISCARD(sec)
85 #else
86 #define MEM_KEEP(sec)
87 #define MEM_DISCARD(sec) *(.mem##sec)
88 #endif
89 
90 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
91 #define MCOUNT_REC()	VMLINUX_SYMBOL(__start_mcount_loc) = .; \
92 			*(__mcount_loc)				\
93 			VMLINUX_SYMBOL(__stop_mcount_loc) = .;
94 #else
95 #define MCOUNT_REC()
96 #endif
97 
98 #ifdef CONFIG_TRACE_BRANCH_PROFILING
99 #define LIKELY_PROFILE()	VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
100 				*(_ftrace_annotated_branch)			      \
101 				VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
102 #else
103 #define LIKELY_PROFILE()
104 #endif
105 
106 #ifdef CONFIG_PROFILE_ALL_BRANCHES
107 #define BRANCH_PROFILE()	VMLINUX_SYMBOL(__start_branch_profile) = .;   \
108 				*(_ftrace_branch)			      \
109 				VMLINUX_SYMBOL(__stop_branch_profile) = .;
110 #else
111 #define BRANCH_PROFILE()
112 #endif
113 
114 #ifdef CONFIG_EVENT_TRACING
115 #define FTRACE_EVENTS()	VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
116 			*(_ftrace_events)				\
117 			VMLINUX_SYMBOL(__stop_ftrace_events) = .;
118 #else
119 #define FTRACE_EVENTS()
120 #endif
121 
122 #ifdef CONFIG_TRACING
123 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .;      \
124 			 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
125 			 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
126 #else
127 #define TRACE_PRINTKS()
128 #endif
129 
130 #ifdef CONFIG_FTRACE_SYSCALLS
131 #define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .;	\
132 			 *(__syscalls_metadata)				\
133 			 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
134 #else
135 #define TRACE_SYSCALLS()
136 #endif
137 
138 /* .data section */
139 #define DATA_DATA							\
140 	*(.data)							\
141 	*(.ref.data)							\
142 	DEV_KEEP(init.data)						\
143 	DEV_KEEP(exit.data)						\
144 	CPU_KEEP(init.data)						\
145 	CPU_KEEP(exit.data)						\
146 	MEM_KEEP(init.data)						\
147 	MEM_KEEP(exit.data)						\
148 	. = ALIGN(8);							\
149 	VMLINUX_SYMBOL(__start___markers) = .;				\
150 	*(__markers)							\
151 	VMLINUX_SYMBOL(__stop___markers) = .;				\
152 	. = ALIGN(32);							\
153 	VMLINUX_SYMBOL(__start___tracepoints) = .;			\
154 	*(__tracepoints)						\
155 	VMLINUX_SYMBOL(__stop___tracepoints) = .;			\
156 	/* implement dynamic printk debug */				\
157 	. = ALIGN(8);							\
158 	VMLINUX_SYMBOL(__start___verbose) = .;                          \
159 	*(__verbose)                                                    \
160 	VMLINUX_SYMBOL(__stop___verbose) = .;				\
161 	LIKELY_PROFILE()		       				\
162 	BRANCH_PROFILE()						\
163 	TRACE_PRINTKS()							\
164 	FTRACE_EVENTS()							\
165 	TRACE_SYSCALLS()
166 
167 /*
168  * Data section helpers
169  */
170 #define NOSAVE_DATA							\
171 	. = ALIGN(PAGE_SIZE);						\
172 	VMLINUX_SYMBOL(__nosave_begin) = .;				\
173 	*(.data.nosave)							\
174 	. = ALIGN(PAGE_SIZE);						\
175 	VMLINUX_SYMBOL(__nosave_end) = .;
176 
177 #define PAGE_ALIGNED_DATA(page_align)					\
178 	. = ALIGN(page_align);						\
179 	*(.data.page_aligned)
180 
181 #define READ_MOSTLY_DATA(align)						\
182 	. = ALIGN(align);						\
183 	*(.data.read_mostly)
184 
185 #define CACHELINE_ALIGNED_DATA(align)					\
186 	. = ALIGN(align);						\
187 	*(.data.cacheline_aligned)
188 
189 #define INIT_TASK_DATA(align)						\
190 	. = ALIGN(align);						\
191 	*(.data.init_task)
192 
193 /*
194  * Read only Data
195  */
196 #define RO_DATA_SECTION(align)						\
197 	. = ALIGN((align));						\
198 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
199 		VMLINUX_SYMBOL(__start_rodata) = .;			\
200 		*(.rodata) *(.rodata.*)					\
201 		*(__vermagic)		/* Kernel version magic */	\
202 		*(__markers_strings)	/* Markers: strings */		\
203 		*(__tracepoints_strings)/* Tracepoints: strings */	\
204 	}								\
205 									\
206 	.rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {		\
207 		*(.rodata1)						\
208 	}								\
209 									\
210 	BUG_TABLE							\
211 									\
212 	/* PCI quirks */						\
213 	.pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {	\
214 		VMLINUX_SYMBOL(__start_pci_fixups_early) = .;		\
215 		*(.pci_fixup_early)					\
216 		VMLINUX_SYMBOL(__end_pci_fixups_early) = .;		\
217 		VMLINUX_SYMBOL(__start_pci_fixups_header) = .;		\
218 		*(.pci_fixup_header)					\
219 		VMLINUX_SYMBOL(__end_pci_fixups_header) = .;		\
220 		VMLINUX_SYMBOL(__start_pci_fixups_final) = .;		\
221 		*(.pci_fixup_final)					\
222 		VMLINUX_SYMBOL(__end_pci_fixups_final) = .;		\
223 		VMLINUX_SYMBOL(__start_pci_fixups_enable) = .;		\
224 		*(.pci_fixup_enable)					\
225 		VMLINUX_SYMBOL(__end_pci_fixups_enable) = .;		\
226 		VMLINUX_SYMBOL(__start_pci_fixups_resume) = .;		\
227 		*(.pci_fixup_resume)					\
228 		VMLINUX_SYMBOL(__end_pci_fixups_resume) = .;		\
229 		VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .;	\
230 		*(.pci_fixup_resume_early)				\
231 		VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .;	\
232 		VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .;		\
233 		*(.pci_fixup_suspend)					\
234 		VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .;		\
235 	}								\
236 									\
237 	/* Built-in firmware blobs */					\
238 	.builtin_fw        : AT(ADDR(.builtin_fw) - LOAD_OFFSET) {	\
239 		VMLINUX_SYMBOL(__start_builtin_fw) = .;			\
240 		*(.builtin_fw)						\
241 		VMLINUX_SYMBOL(__end_builtin_fw) = .;			\
242 	}								\
243 									\
244 	/* RapidIO route ops */						\
245 	.rio_route        : AT(ADDR(.rio_route) - LOAD_OFFSET) {	\
246 		VMLINUX_SYMBOL(__start_rio_route_ops) = .;		\
247 		*(.rio_route_ops)					\
248 		VMLINUX_SYMBOL(__end_rio_route_ops) = .;		\
249 	}								\
250 									\
251 	TRACEDATA							\
252 									\
253 	/* Kernel symbol table: Normal symbols */			\
254 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
255 		VMLINUX_SYMBOL(__start___ksymtab) = .;			\
256 		*(__ksymtab)						\
257 		VMLINUX_SYMBOL(__stop___ksymtab) = .;			\
258 	}								\
259 									\
260 	/* Kernel symbol table: GPL-only symbols */			\
261 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
262 		VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;		\
263 		*(__ksymtab_gpl)					\
264 		VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;		\
265 	}								\
266 									\
267 	/* Kernel symbol table: Normal unused symbols */		\
268 	__ksymtab_unused  : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) {	\
269 		VMLINUX_SYMBOL(__start___ksymtab_unused) = .;		\
270 		*(__ksymtab_unused)					\
271 		VMLINUX_SYMBOL(__stop___ksymtab_unused) = .;		\
272 	}								\
273 									\
274 	/* Kernel symbol table: GPL-only unused symbols */		\
275 	__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
276 		VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .;	\
277 		*(__ksymtab_unused_gpl)					\
278 		VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .;	\
279 	}								\
280 									\
281 	/* Kernel symbol table: GPL-future-only symbols */		\
282 	__ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
283 		VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .;	\
284 		*(__ksymtab_gpl_future)					\
285 		VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .;	\
286 	}								\
287 									\
288 	/* Kernel symbol table: Normal symbols */			\
289 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
290 		VMLINUX_SYMBOL(__start___kcrctab) = .;			\
291 		*(__kcrctab)						\
292 		VMLINUX_SYMBOL(__stop___kcrctab) = .;			\
293 	}								\
294 									\
295 	/* Kernel symbol table: GPL-only symbols */			\
296 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
297 		VMLINUX_SYMBOL(__start___kcrctab_gpl) = .;		\
298 		*(__kcrctab_gpl)					\
299 		VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .;		\
300 	}								\
301 									\
302 	/* Kernel symbol table: Normal unused symbols */		\
303 	__kcrctab_unused  : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) {	\
304 		VMLINUX_SYMBOL(__start___kcrctab_unused) = .;		\
305 		*(__kcrctab_unused)					\
306 		VMLINUX_SYMBOL(__stop___kcrctab_unused) = .;		\
307 	}								\
308 									\
309 	/* Kernel symbol table: GPL-only unused symbols */		\
310 	__kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
311 		VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .;	\
312 		*(__kcrctab_unused_gpl)					\
313 		VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .;	\
314 	}								\
315 									\
316 	/* Kernel symbol table: GPL-future-only symbols */		\
317 	__kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
318 		VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .;	\
319 		*(__kcrctab_gpl_future)					\
320 		VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .;	\
321 	}								\
322 									\
323 	/* Kernel symbol table: strings */				\
324         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {	\
325 		*(__ksymtab_strings)					\
326 	}								\
327 									\
328 	/* __*init sections */						\
329 	__init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {		\
330 		*(.ref.rodata)						\
331 		MCOUNT_REC()						\
332 		DEV_KEEP(init.rodata)					\
333 		DEV_KEEP(exit.rodata)					\
334 		CPU_KEEP(init.rodata)					\
335 		CPU_KEEP(exit.rodata)					\
336 		MEM_KEEP(init.rodata)					\
337 		MEM_KEEP(exit.rodata)					\
338 	}								\
339 									\
340 	/* Built-in module parameters. */				\
341 	__param : AT(ADDR(__param) - LOAD_OFFSET) {			\
342 		VMLINUX_SYMBOL(__start___param) = .;			\
343 		*(__param)						\
344 		VMLINUX_SYMBOL(__stop___param) = .;			\
345 		. = ALIGN((align));					\
346 		VMLINUX_SYMBOL(__end_rodata) = .;			\
347 	}								\
348 	. = ALIGN((align));
349 
350 /* RODATA & RO_DATA provided for backward compatibility.
351  * All archs are supposed to use RO_DATA() */
352 #define RODATA          RO_DATA_SECTION(4096)
353 #define RO_DATA(align)  RO_DATA_SECTION(align)
354 
355 #define SECURITY_INIT							\
356 	.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
357 		VMLINUX_SYMBOL(__security_initcall_start) = .;		\
358 		*(.security_initcall.init) 				\
359 		VMLINUX_SYMBOL(__security_initcall_end) = .;		\
360 	}
361 
362 /* .text section. Map to function alignment to avoid address changes
363  * during second ld run in second ld pass when generating System.map */
364 #define TEXT_TEXT							\
365 		ALIGN_FUNCTION();					\
366 		*(.text.hot)						\
367 		*(.text)						\
368 		*(.ref.text)						\
369 	DEV_KEEP(init.text)						\
370 	DEV_KEEP(exit.text)						\
371 	CPU_KEEP(init.text)						\
372 	CPU_KEEP(exit.text)						\
373 	MEM_KEEP(init.text)						\
374 	MEM_KEEP(exit.text)						\
375 		*(.text.unlikely)
376 
377 
378 /* sched.text is aling to function alignment to secure we have same
379  * address even at second ld pass when generating System.map */
380 #define SCHED_TEXT							\
381 		ALIGN_FUNCTION();					\
382 		VMLINUX_SYMBOL(__sched_text_start) = .;			\
383 		*(.sched.text)						\
384 		VMLINUX_SYMBOL(__sched_text_end) = .;
385 
386 /* spinlock.text is aling to function alignment to secure we have same
387  * address even at second ld pass when generating System.map */
388 #define LOCK_TEXT							\
389 		ALIGN_FUNCTION();					\
390 		VMLINUX_SYMBOL(__lock_text_start) = .;			\
391 		*(.spinlock.text)					\
392 		VMLINUX_SYMBOL(__lock_text_end) = .;
393 
394 #define KPROBES_TEXT							\
395 		ALIGN_FUNCTION();					\
396 		VMLINUX_SYMBOL(__kprobes_text_start) = .;		\
397 		*(.kprobes.text)					\
398 		VMLINUX_SYMBOL(__kprobes_text_end) = .;
399 
400 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
401 #define IRQENTRY_TEXT							\
402 		ALIGN_FUNCTION();					\
403 		VMLINUX_SYMBOL(__irqentry_text_start) = .;		\
404 		*(.irqentry.text)					\
405 		VMLINUX_SYMBOL(__irqentry_text_end) = .;
406 #else
407 #define IRQENTRY_TEXT
408 #endif
409 
410 /* Section used for early init (in .S files) */
411 #define HEAD_TEXT  *(.head.text)
412 
413 #define HEAD_TEXT_SECTION							\
414 	.head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {		\
415 		HEAD_TEXT						\
416 	}
417 
418 /*
419  * Exception table
420  */
421 #define EXCEPTION_TABLE(align)						\
422 	. = ALIGN(align);						\
423 	__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {		\
424 		VMLINUX_SYMBOL(__start___ex_table) = .;			\
425 		*(__ex_table)						\
426 		VMLINUX_SYMBOL(__stop___ex_table) = .;			\
427 	}
428 
429 /*
430  * Init task
431  */
432 #define INIT_TASK_DATA_SECTION(align)					\
433 	. = ALIGN(align);						\
434 	.data.init_task : {						\
435 		INIT_TASK_DATA(align)					\
436 	}
437 
438 #ifdef CONFIG_CONSTRUCTORS
439 #define KERNEL_CTORS()	. = ALIGN(8);			   \
440 			VMLINUX_SYMBOL(__ctors_start) = .; \
441 			*(.ctors)			   \
442 			VMLINUX_SYMBOL(__ctors_end) = .;
443 #else
444 #define KERNEL_CTORS()
445 #endif
446 
447 /* init and exit section handling */
448 #define INIT_DATA							\
449 	*(.init.data)							\
450 	DEV_DISCARD(init.data)						\
451 	CPU_DISCARD(init.data)						\
452 	MEM_DISCARD(init.data)						\
453 	KERNEL_CTORS()							\
454 	*(.init.rodata)							\
455 	DEV_DISCARD(init.rodata)					\
456 	CPU_DISCARD(init.rodata)					\
457 	MEM_DISCARD(init.rodata)
458 
459 #define INIT_TEXT							\
460 	*(.init.text)							\
461 	DEV_DISCARD(init.text)						\
462 	CPU_DISCARD(init.text)						\
463 	MEM_DISCARD(init.text)
464 
465 #define EXIT_DATA							\
466 	*(.exit.data)							\
467 	DEV_DISCARD(exit.data)						\
468 	DEV_DISCARD(exit.rodata)					\
469 	CPU_DISCARD(exit.data)						\
470 	CPU_DISCARD(exit.rodata)					\
471 	MEM_DISCARD(exit.data)						\
472 	MEM_DISCARD(exit.rodata)
473 
474 #define EXIT_TEXT							\
475 	*(.exit.text)							\
476 	DEV_DISCARD(exit.text)						\
477 	CPU_DISCARD(exit.text)						\
478 	MEM_DISCARD(exit.text)
479 
480 #define EXIT_CALL							\
481 	*(.exitcall.exit)
482 
483 /*
484  * bss (Block Started by Symbol) - uninitialized data
485  * zeroed during startup
486  */
487 #define SBSS(sbss_align)						\
488 	. = ALIGN(sbss_align);						\
489 	.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) {				\
490 		*(.sbss)						\
491 		*(.scommon)						\
492 	}
493 
494 #define BSS(bss_align)							\
495 	. = ALIGN(bss_align);						\
496 	.bss : AT(ADDR(.bss) - LOAD_OFFSET) {				\
497 		*(.bss.page_aligned)					\
498 		*(.dynbss)						\
499 		*(.bss)							\
500 		*(COMMON)						\
501 	}
502 
503 /*
504  * DWARF debug sections.
505  * Symbols in the DWARF debugging sections are relative to
506  * the beginning of the section so we begin them at 0.
507  */
508 #define DWARF_DEBUG							\
509 		/* DWARF 1 */						\
510 		.debug          0 : { *(.debug) }			\
511 		.line           0 : { *(.line) }			\
512 		/* GNU DWARF 1 extensions */				\
513 		.debug_srcinfo  0 : { *(.debug_srcinfo) }		\
514 		.debug_sfnames  0 : { *(.debug_sfnames) }		\
515 		/* DWARF 1.1 and DWARF 2 */				\
516 		.debug_aranges  0 : { *(.debug_aranges) }		\
517 		.debug_pubnames 0 : { *(.debug_pubnames) }		\
518 		/* DWARF 2 */						\
519 		.debug_info     0 : { *(.debug_info			\
520 				.gnu.linkonce.wi.*) }			\
521 		.debug_abbrev   0 : { *(.debug_abbrev) }		\
522 		.debug_line     0 : { *(.debug_line) }			\
523 		.debug_frame    0 : { *(.debug_frame) }			\
524 		.debug_str      0 : { *(.debug_str) }			\
525 		.debug_loc      0 : { *(.debug_loc) }			\
526 		.debug_macinfo  0 : { *(.debug_macinfo) }		\
527 		/* SGI/MIPS DWARF 2 extensions */			\
528 		.debug_weaknames 0 : { *(.debug_weaknames) }		\
529 		.debug_funcnames 0 : { *(.debug_funcnames) }		\
530 		.debug_typenames 0 : { *(.debug_typenames) }		\
531 		.debug_varnames  0 : { *(.debug_varnames) }		\
532 
533 		/* Stabs debugging sections.  */
534 #define STABS_DEBUG							\
535 		.stab 0 : { *(.stab) }					\
536 		.stabstr 0 : { *(.stabstr) }				\
537 		.stab.excl 0 : { *(.stab.excl) }			\
538 		.stab.exclstr 0 : { *(.stab.exclstr) }			\
539 		.stab.index 0 : { *(.stab.index) }			\
540 		.stab.indexstr 0 : { *(.stab.indexstr) }		\
541 		.comment 0 : { *(.comment) }
542 
543 #ifdef CONFIG_GENERIC_BUG
544 #define BUG_TABLE							\
545 	. = ALIGN(8);							\
546 	__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) {		\
547 		VMLINUX_SYMBOL(__start___bug_table) = .;		\
548 		*(__bug_table)						\
549 		VMLINUX_SYMBOL(__stop___bug_table) = .;			\
550 	}
551 #else
552 #define BUG_TABLE
553 #endif
554 
555 #ifdef CONFIG_PM_TRACE
556 #define TRACEDATA							\
557 	. = ALIGN(4);							\
558 	.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {		\
559 		VMLINUX_SYMBOL(__tracedata_start) = .;			\
560 		*(.tracedata)						\
561 		VMLINUX_SYMBOL(__tracedata_end) = .;			\
562 	}
563 #else
564 #define TRACEDATA
565 #endif
566 
567 #define NOTES								\
568 	.notes : AT(ADDR(.notes) - LOAD_OFFSET) {			\
569 		VMLINUX_SYMBOL(__start_notes) = .;			\
570 		*(.note.*)						\
571 		VMLINUX_SYMBOL(__stop_notes) = .;			\
572 	}
573 
574 #define INIT_SETUP(initsetup_align)					\
575 		. = ALIGN(initsetup_align);				\
576 		VMLINUX_SYMBOL(__setup_start) = .;			\
577 		*(.init.setup)						\
578 		VMLINUX_SYMBOL(__setup_end) = .;
579 
580 #define INITCALLS							\
581 	*(.initcallearly.init)						\
582 	VMLINUX_SYMBOL(__early_initcall_end) = .;			\
583   	*(.initcall0.init)						\
584   	*(.initcall0s.init)						\
585   	*(.initcall1.init)						\
586   	*(.initcall1s.init)						\
587   	*(.initcall2.init)						\
588   	*(.initcall2s.init)						\
589   	*(.initcall3.init)						\
590   	*(.initcall3s.init)						\
591   	*(.initcall4.init)						\
592   	*(.initcall4s.init)						\
593   	*(.initcall5.init)						\
594   	*(.initcall5s.init)						\
595 	*(.initcallrootfs.init)						\
596   	*(.initcall6.init)						\
597   	*(.initcall6s.init)						\
598   	*(.initcall7.init)						\
599   	*(.initcall7s.init)
600 
601 #define INIT_CALLS							\
602 		VMLINUX_SYMBOL(__initcall_start) = .;			\
603 		INITCALLS						\
604 		VMLINUX_SYMBOL(__initcall_end) = .;
605 
606 #define CON_INITCALL							\
607 		VMLINUX_SYMBOL(__con_initcall_start) = .;		\
608 		*(.con_initcall.init)					\
609 		VMLINUX_SYMBOL(__con_initcall_end) = .;
610 
611 #define SECURITY_INITCALL						\
612 		VMLINUX_SYMBOL(__security_initcall_start) = .;		\
613 		*(.security_initcall.init)				\
614 		VMLINUX_SYMBOL(__security_initcall_end) = .;
615 
616 #ifdef CONFIG_BLK_DEV_INITRD
617 #define INIT_RAM_FS							\
618 	. = ALIGN(PAGE_SIZE);						\
619 	VMLINUX_SYMBOL(__initramfs_start) = .;				\
620 	*(.init.ramfs)							\
621 	VMLINUX_SYMBOL(__initramfs_end) = .;
622 #else
623 #define INIT_RAM_FS
624 #endif
625 
626 /*
627  * Default discarded sections.
628  *
629  * Some archs want to discard exit text/data at runtime rather than
630  * link time due to cross-section references such as alt instructions,
631  * bug table, eh_frame, etc.  DISCARDS must be the last of output
632  * section definitions so that such archs put those in earlier section
633  * definitions.
634  */
635 #define DISCARDS							\
636 	/DISCARD/ : {							\
637 	EXIT_TEXT							\
638 	EXIT_DATA							\
639 	EXIT_CALL							\
640 	*(.discard)							\
641 	}
642 
643 /**
644  * PERCPU_VADDR - define output section for percpu area
645  * @vaddr: explicit base address (optional)
646  * @phdr: destination PHDR (optional)
647  *
648  * Macro which expands to output section for percpu area.  If @vaddr
649  * is not blank, it specifies explicit base address and all percpu
650  * symbols will be offset from the given address.  If blank, @vaddr
651  * always equals @laddr + LOAD_OFFSET.
652  *
653  * @phdr defines the output PHDR to use if not blank.  Be warned that
654  * output PHDR is sticky.  If @phdr is specified, the next output
655  * section in the linker script will go there too.  @phdr should have
656  * a leading colon.
657  *
658  * Note that this macros defines __per_cpu_load as an absolute symbol.
659  * If there is no need to put the percpu section at a predetermined
660  * address, use PERCPU().
661  */
662 #define PERCPU_VADDR(vaddr, phdr)					\
663 	VMLINUX_SYMBOL(__per_cpu_load) = .;				\
664 	.data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load)		\
665 				- LOAD_OFFSET) {			\
666 		VMLINUX_SYMBOL(__per_cpu_start) = .;			\
667 		*(.data.percpu.first)					\
668 		*(.data.percpu.page_aligned)				\
669 		*(.data.percpu)						\
670 		*(.data.percpu.shared_aligned)				\
671 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
672 	} phdr								\
673 	. = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu);
674 
675 /**
676  * PERCPU - define output section for percpu area, simple version
677  * @align: required alignment
678  *
679  * Align to @align and outputs output section for percpu area.  This
680  * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
681  * __per_cpu_start will be identical.
682  *
683  * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
684  * that __per_cpu_load is defined as a relative symbol against
685  * .data.percpu which is required for relocatable x86_32
686  * configuration.
687  */
688 #define PERCPU(align)							\
689 	. = ALIGN(align);						\
690 	.data.percpu	: AT(ADDR(.data.percpu) - LOAD_OFFSET) {	\
691 		VMLINUX_SYMBOL(__per_cpu_load) = .;			\
692 		VMLINUX_SYMBOL(__per_cpu_start) = .;			\
693 		*(.data.percpu.first)					\
694 		*(.data.percpu.page_aligned)				\
695 		*(.data.percpu)						\
696 		*(.data.percpu.shared_aligned)				\
697 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
698 	}
699 
700 
701 /*
702  * Definition of the high level *_SECTION macros
703  * They will fit only a subset of the architectures
704  */
705 
706 
707 /*
708  * Writeable data.
709  * All sections are combined in a single .data section.
710  * The sections following CONSTRUCTORS are arranged so their
711  * typical alignment matches.
712  * A cacheline is typical/always less than a PAGE_SIZE so
713  * the sections that has this restriction (or similar)
714  * is located before the ones requiring PAGE_SIZE alignment.
715  * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
716  * matches the requirment of PAGE_ALIGNED_DATA.
717  *
718  * use 0 as page_align if page_aligned data is not used */
719 #define RW_DATA_SECTION(cacheline, pagealigned, inittask)		\
720 	. = ALIGN(PAGE_SIZE);						\
721 	.data : AT(ADDR(.data) - LOAD_OFFSET) {				\
722 		INIT_TASK_DATA(inittask)				\
723 		CACHELINE_ALIGNED_DATA(cacheline)			\
724 		READ_MOSTLY_DATA(cacheline)				\
725 		DATA_DATA						\
726 		CONSTRUCTORS						\
727 		NOSAVE_DATA						\
728 		PAGE_ALIGNED_DATA(pagealigned)				\
729 	}
730 
731 #define INIT_TEXT_SECTION(inittext_align)				\
732 	. = ALIGN(inittext_align);					\
733 	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {		\
734 		VMLINUX_SYMBOL(_sinittext) = .;				\
735 		INIT_TEXT						\
736 		VMLINUX_SYMBOL(_einittext) = .;				\
737 	}
738 
739 #define INIT_DATA_SECTION(initsetup_align)				\
740 	.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {		\
741 		INIT_DATA						\
742 		INIT_SETUP(initsetup_align)				\
743 		INIT_CALLS						\
744 		CON_INITCALL						\
745 		SECURITY_INITCALL					\
746 		INIT_RAM_FS						\
747 	}
748 
749 #define BSS_SECTION(sbss_align, bss_align, stop_align)			\
750 	. = ALIGN(sbss_align);						\
751 	VMLINUX_SYMBOL(__bss_start) = .;				\
752 	SBSS(sbss_align)						\
753 	BSS(bss_align)							\
754 	. = ALIGN(stop_align);						\
755 	VMLINUX_SYMBOL(__bss_stop) = .;
756