blob: ae0166e83490455599f3b4cd21a99920d1f7dc20 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef LOAD_OFFSET
2#define LOAD_OFFSET 0
3#endif
4
5#ifndef VMLINUX_SYMBOL
6#define VMLINUX_SYMBOL(_sym_) _sym_
7#endif
8
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +00009/* Align . to a 8 byte boundary equals to maximum function alignment. */
10#define ALIGN_FUNCTION() . = ALIGN(8)
11
Sam Ravnborgca967252007-05-17 13:38:44 +020012/* .data section */
13#define DATA_DATA \
Sam Ravnborg0e0d3142007-05-17 20:14:48 +020014 *(.data) \
Mathieu Desnoyers8256e472007-10-18 23:41:06 -070015 *(.data.init.refok) \
16 . = ALIGN(8); \
17 VMLINUX_SYMBOL(__start___markers) = .; \
18 *(__markers) \
19 VMLINUX_SYMBOL(__stop___markers) = .;
Sam Ravnborgca967252007-05-17 13:38:44 +020020
Sam Ravnborg4096b462007-05-29 21:29:00 +020021#define RO_DATA(align) \
22 . = ALIGN((align)); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
Vivek Goyal65695802006-12-07 02:14:03 +010024 VMLINUX_SYMBOL(__start_rodata) = .; \
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 *(.rodata) *(.rodata.*) \
26 *(__vermagic) /* Kernel version magic */ \
Mathieu Desnoyers8256e472007-10-18 23:41:06 -070027 *(__markers_strings) /* Markers: strings */ \
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 } \
29 \
30 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
31 *(.rodata1) \
32 } \
33 \
34 /* PCI quirks */ \
35 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
36 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
37 *(.pci_fixup_early) \
38 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
39 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
40 *(.pci_fixup_header) \
41 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
42 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
43 *(.pci_fixup_final) \
44 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
45 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
46 *(.pci_fixup_enable) \
47 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
Alan Cox1597cac2006-12-04 15:14:45 -080048 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
49 *(.pci_fixup_resume) \
50 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 } \
52 \
Matt Porter394b7012005-11-07 01:00:15 -080053 /* RapidIO route ops */ \
54 .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \
55 VMLINUX_SYMBOL(__start_rio_route_ops) = .; \
56 *(.rio_route_ops) \
57 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
58 } \
59 \
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 /* Kernel symbol table: Normal symbols */ \
61 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
62 VMLINUX_SYMBOL(__start___ksymtab) = .; \
63 *(__ksymtab) \
64 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
65 } \
66 \
67 /* Kernel symbol table: GPL-only symbols */ \
68 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
69 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
70 *(__ksymtab_gpl) \
71 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
72 } \
73 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -070074 /* Kernel symbol table: Normal unused symbols */ \
75 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
76 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
77 *(__ksymtab_unused) \
78 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
79 } \
80 \
81 /* Kernel symbol table: GPL-only unused symbols */ \
82 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
83 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
84 *(__ksymtab_unused_gpl) \
85 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
86 } \
87 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -080088 /* Kernel symbol table: GPL-future-only symbols */ \
89 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
90 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
91 *(__ksymtab_gpl_future) \
92 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
93 } \
94 \
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 /* Kernel symbol table: Normal symbols */ \
96 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
97 VMLINUX_SYMBOL(__start___kcrctab) = .; \
98 *(__kcrctab) \
99 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
100 } \
101 \
102 /* Kernel symbol table: GPL-only symbols */ \
103 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
104 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
105 *(__kcrctab_gpl) \
106 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
107 } \
108 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -0700109 /* Kernel symbol table: Normal unused symbols */ \
110 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
111 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
112 *(__kcrctab_unused) \
113 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
114 } \
115 \
116 /* Kernel symbol table: GPL-only unused symbols */ \
117 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
118 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
119 *(__kcrctab_unused_gpl) \
120 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
121 } \
122 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -0800123 /* Kernel symbol table: GPL-future-only symbols */ \
124 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
125 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
126 *(__kcrctab_gpl_future) \
127 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
128 } \
129 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 /* Kernel symbol table: strings */ \
131 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
132 *(__ksymtab_strings) \
133 } \
134 \
135 /* Built-in module parameters. */ \
136 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
137 VMLINUX_SYMBOL(__start___param) = .; \
138 *(__param) \
139 VMLINUX_SYMBOL(__stop___param) = .; \
Vivek Goyal65695802006-12-07 02:14:03 +0100140 VMLINUX_SYMBOL(__end_rodata) = .; \
Marcelo Tosatti7583ddf2006-09-27 01:51:02 -0700141 } \
Jan Beulich690a9732006-10-21 18:37:01 +0200142 \
Sam Ravnborg4096b462007-05-29 21:29:00 +0200143 . = ALIGN((align));
144
145/* RODATA provided for backward compatibility.
146 * All archs are supposed to use RO_DATA() */
147#define RODATA RO_DATA(4096)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149#define SECURITY_INIT \
Eric W. Biederman60bad7f2005-06-25 14:57:46 -0700150 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 VMLINUX_SYMBOL(__security_initcall_start) = .; \
152 *(.security_initcall.init) \
153 VMLINUX_SYMBOL(__security_initcall_end) = .; \
154 }
155
Sam Ravnborg76647092007-05-13 00:31:33 +0200156/* .text section. Map to function alignment to avoid address changes
157 * during second ld run in second ld pass when generating System.map */
158#define TEXT_TEXT \
159 ALIGN_FUNCTION(); \
Sam Ravnborg0e0d3142007-05-17 20:14:48 +0200160 *(.text) \
Al Viro23ec23c2007-10-13 08:40:24 +0100161 *(.text.init.refok) \
162 *(.exit.text.refok)
Sam Ravnborg76647092007-05-13 00:31:33 +0200163
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000164/* sched.text is aling to function alignment to secure we have same
165 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166#define SCHED_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000167 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 VMLINUX_SYMBOL(__sched_text_start) = .; \
169 *(.sched.text) \
170 VMLINUX_SYMBOL(__sched_text_end) = .;
171
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000172/* spinlock.text is aling to function alignment to secure we have same
173 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174#define LOCK_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000175 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 VMLINUX_SYMBOL(__lock_text_start) = .; \
177 *(.spinlock.text) \
178 VMLINUX_SYMBOL(__lock_text_end) = .;
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -0700179
180#define KPROBES_TEXT \
181 ALIGN_FUNCTION(); \
182 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
183 *(.kprobes.text) \
184 VMLINUX_SYMBOL(__kprobes_text_end) = .;
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200185
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100186/* init and exit section handling */
187#define INIT_TEXT *(.init.text)
188#define INIT_DATA *(.init.data)
189#define EXIT_TEXT *(.exit.text)
190#define EXIT_DATA *(.exit.data)
191
192
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200193 /* DWARF debug sections.
194 Symbols in the DWARF debugging sections are relative to
195 the beginning of the section so we begin them at 0. */
196#define DWARF_DEBUG \
197 /* DWARF 1 */ \
198 .debug 0 : { *(.debug) } \
199 .line 0 : { *(.line) } \
200 /* GNU DWARF 1 extensions */ \
201 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
202 .debug_sfnames 0 : { *(.debug_sfnames) } \
203 /* DWARF 1.1 and DWARF 2 */ \
204 .debug_aranges 0 : { *(.debug_aranges) } \
205 .debug_pubnames 0 : { *(.debug_pubnames) } \
206 /* DWARF 2 */ \
207 .debug_info 0 : { *(.debug_info \
208 .gnu.linkonce.wi.*) } \
209 .debug_abbrev 0 : { *(.debug_abbrev) } \
210 .debug_line 0 : { *(.debug_line) } \
211 .debug_frame 0 : { *(.debug_frame) } \
212 .debug_str 0 : { *(.debug_str) } \
213 .debug_loc 0 : { *(.debug_loc) } \
214 .debug_macinfo 0 : { *(.debug_macinfo) } \
215 /* SGI/MIPS DWARF 2 extensions */ \
216 .debug_weaknames 0 : { *(.debug_weaknames) } \
217 .debug_funcnames 0 : { *(.debug_funcnames) } \
218 .debug_typenames 0 : { *(.debug_typenames) } \
219 .debug_varnames 0 : { *(.debug_varnames) } \
220
221 /* Stabs debugging sections. */
222#define STABS_DEBUG \
223 .stab 0 : { *(.stab) } \
224 .stabstr 0 : { *(.stabstr) } \
225 .stab.excl 0 : { *(.stab.excl) } \
226 .stab.exclstr 0 : { *(.stab.exclstr) } \
227 .stab.index 0 : { *(.stab.index) } \
228 .stab.indexstr 0 : { *(.stab.indexstr) } \
229 .comment 0 : { *(.comment) }
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700230
Jeremy Fitzhardinge7664c5a2006-12-08 02:36:19 -0800231#define BUG_TABLE \
232 . = ALIGN(8); \
233 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
234 __start___bug_table = .; \
235 *(__bug_table) \
236 __stop___bug_table = .; \
237 }
238
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700239#define NOTES \
Roland McGrathcbe87122007-07-19 01:48:36 -0700240 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
241 VMLINUX_SYMBOL(__start_notes) = .; \
242 *(.note.*) \
243 VMLINUX_SYMBOL(__stop_notes) = .; \
244 }
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700245
246#define INITCALLS \
Linus Torvaldsb3438f82006-11-20 11:47:18 -0800247 *(.initcall0.init) \
248 *(.initcall0s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700249 *(.initcall1.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700250 *(.initcall1s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700251 *(.initcall2.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700252 *(.initcall2s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700253 *(.initcall3.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700254 *(.initcall3s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700255 *(.initcall4.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700256 *(.initcall4s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700257 *(.initcall5.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700258 *(.initcall5s.init) \
Linus Torvalds8d610dd2006-12-11 12:12:04 -0800259 *(.initcallrootfs.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700260 *(.initcall6.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700261 *(.initcall6s.init) \
262 *(.initcall7.init) \
263 *(.initcall7s.init)
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700264
Fenghua Yu5fb7dc32007-07-19 01:48:12 -0700265#define PERCPU(align) \
266 . = ALIGN(align); \
267 __per_cpu_start = .; \
268 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
269 *(.data.percpu) \
270 *(.data.percpu.shared_aligned) \
271 } \
272 __per_cpu_end = .;