Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* ld script to make i386 Linux kernel |
2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; | |
6569580d VG |
3 | * |
4 | * Don't define absolute symbols until and unless you know that symbol | |
5 | * value is should remain constant even if kernel image is relocated | |
6 | * at run time. Absolute symbols are not relocated. If symbol value should | |
7 | * change if kernel is relocated, make the symbol section relative and | |
8 | * put it inside the section definition. | |
1da177e4 LT |
9 | */ |
10 | ||
79929fd1 VG |
11 | /* Don't define absolute symbols until and unless you know that symbol |
12 | * value is should remain constant even if kernel image is relocated | |
13 | * at run time. Absolute symbols are not relocated. If symbol value should | |
14 | * change if kernel is relocated, make the symbol section relative and | |
15 | * put it inside the section definition. | |
16 | */ | |
ad0d75eb EB |
17 | #define LOAD_OFFSET __PAGE_OFFSET |
18 | ||
1da177e4 LT |
19 | #include <asm-generic/vmlinux.lds.h> |
20 | #include <asm/thread_info.h> | |
21 | #include <asm/page.h> | |
379b5441 | 22 | #include <asm/cache.h> |
e69f202d | 23 | #include <asm/boot.h> |
1da177e4 LT |
24 | |
25 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") | |
26 | OUTPUT_ARCH(i386) | |
ad0d75eb | 27 | ENTRY(phys_startup_32) |
1da177e4 | 28 | jiffies = jiffies_64; |
1bac3b38 | 29 | _proxy_pda = 0; |
9c9b8b38 JF |
30 | |
31 | PHDRS { | |
32 | text PT_LOAD FLAGS(5); /* R_E */ | |
33 | data PT_LOAD FLAGS(7); /* RWE */ | |
34 | note PT_NOTE FLAGS(4); /* R__ */ | |
35 | } | |
1da177e4 LT |
36 | SECTIONS |
37 | { | |
e69f202d | 38 | . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; |
ad0d75eb | 39 | phys_startup_32 = startup_32 - LOAD_OFFSET; |
f8657e1b VG |
40 | |
41 | .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) { | |
42 | _text = .; /* Text and read-only data */ | |
43 | *(.text.head) | |
44 | } :text = 0x9090 | |
45 | ||
1da177e4 | 46 | /* read-only */ |
ad0d75eb | 47 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
1da177e4 LT |
48 | *(.text) |
49 | SCHED_TEXT | |
50 | LOCK_TEXT | |
3d97ae5b | 51 | KPROBES_TEXT |
1da177e4 LT |
52 | *(.fixup) |
53 | *(.gnu.warning) | |
6569580d VG |
54 | _etext = .; /* End of text section */ |
55 | } :text = 0x9090 | |
1da177e4 LT |
56 | |
57 | . = ALIGN(16); /* Exception table */ | |
6569580d VG |
58 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { |
59 | __start___ex_table = .; | |
60 | *(__ex_table) | |
61 | __stop___ex_table = .; | |
62 | } | |
1da177e4 LT |
63 | |
64 | RODATA | |
65 | ||
91768d6c JF |
66 | BUG_TABLE |
67 | ||
eb71c87a | 68 | . = ALIGN(4); |
eb71c87a | 69 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { |
6569580d | 70 | __tracedata_start = .; |
eb71c87a | 71 | *(.tracedata) |
6569580d | 72 | __tracedata_end = .; |
eb71c87a | 73 | } |
eb71c87a | 74 | |
1da177e4 | 75 | /* writeable */ |
c06cb8b1 | 76 | . = ALIGN(4096); |
ad0d75eb | 77 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
1da177e4 LT |
78 | *(.data) |
79 | CONSTRUCTORS | |
9c9b8b38 | 80 | } :data |
1da177e4 | 81 | |
c9ccf30d | 82 | .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) { |
79929fd1 | 83 | __start_paravirtprobe = .; |
c9ccf30d | 84 | *(.paravirtprobe) |
79929fd1 | 85 | __stop_paravirtprobe = .; |
c9ccf30d | 86 | } |
c9ccf30d | 87 | |
1da177e4 | 88 | . = ALIGN(4096); |
6569580d VG |
89 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
90 | __nosave_begin = .; | |
91 | *(.data.nosave) | |
92 | . = ALIGN(4096); | |
93 | __nosave_end = .; | |
94 | } | |
1da177e4 LT |
95 | |
96 | . = ALIGN(4096); | |
ad0d75eb EB |
97 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
98 | *(.data.idt) | |
99 | } | |
1da177e4 LT |
100 | |
101 | . = ALIGN(32); | |
ad0d75eb EB |
102 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
103 | *(.data.cacheline_aligned) | |
104 | } | |
1da177e4 | 105 | |
6c036527 CL |
106 | /* rarely changed data like cpu maps */ |
107 | . = ALIGN(32); | |
6569580d VG |
108 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { |
109 | *(.data.read_mostly) | |
110 | _edata = .; /* End of data section */ | |
111 | } | |
1da177e4 LT |
112 | |
113 | . = ALIGN(THREAD_SIZE); /* init_task */ | |
ad0d75eb EB |
114 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
115 | *(.data.init_task) | |
116 | } | |
1da177e4 | 117 | |
9a0b5817 GH |
118 | /* might get freed after init */ |
119 | . = ALIGN(4096); | |
9a0b5817 | 120 | .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) { |
6569580d VG |
121 | __smp_alt_begin = .; |
122 | __smp_alt_instructions = .; | |
9a0b5817 | 123 | *(.smp_altinstructions) |
6569580d | 124 | __smp_alt_instructions_end = .; |
9a0b5817 | 125 | } |
9a0b5817 | 126 | . = ALIGN(4); |
9a0b5817 | 127 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { |
6569580d | 128 | __smp_locks = .; |
9a0b5817 | 129 | *(.smp_locks) |
6569580d | 130 | __smp_locks_end = .; |
9a0b5817 | 131 | } |
9a0b5817 GH |
132 | .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) { |
133 | *(.smp_altinstr_replacement) | |
6569580d | 134 | __smp_alt_end = .; |
9a0b5817 | 135 | } |
6ed01884 VG |
136 | /* will be freed after init |
137 | * Following ALIGN() is required to make sure no other data falls on the | |
138 | * same page where __smp_alt_end is pointing as that page might be freed | |
139 | * after boot. Always make sure that ALIGN() directive is present after | |
140 | * the section which contains __smp_alt_end. | |
141 | */ | |
9a0b5817 | 142 | . = ALIGN(4096); |
9a0b5817 | 143 | |
1da177e4 LT |
144 | /* will be freed after init */ |
145 | . = ALIGN(4096); /* Init code and data */ | |
ad0d75eb | 146 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
6569580d | 147 | __init_begin = .; |
1da177e4 LT |
148 | _sinittext = .; |
149 | *(.init.text) | |
150 | _einittext = .; | |
151 | } | |
ad0d75eb | 152 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
1da177e4 | 153 | . = ALIGN(16); |
6569580d VG |
154 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
155 | __setup_start = .; | |
156 | *(.init.setup) | |
157 | __setup_end = .; | |
158 | } | |
ad0d75eb | 159 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
6569580d | 160 | __initcall_start = .; |
61ce1efe | 161 | INITCALLS |
6569580d | 162 | __initcall_end = .; |
1da177e4 | 163 | } |
ad0d75eb | 164 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
6569580d | 165 | __con_initcall_start = .; |
ad0d75eb | 166 | *(.con_initcall.init) |
6569580d | 167 | __con_initcall_end = .; |
ad0d75eb | 168 | } |
1da177e4 LT |
169 | SECURITY_INIT |
170 | . = ALIGN(4); | |
ad0d75eb | 171 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
6569580d | 172 | __alt_instructions = .; |
ad0d75eb | 173 | *(.altinstructions) |
6569580d | 174 | __alt_instructions_end = .; |
ad0d75eb | 175 | } |
ad0d75eb EB |
176 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
177 | *(.altinstr_replacement) | |
178 | } | |
139ec7c4 | 179 | . = ALIGN(4); |
139ec7c4 | 180 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { |
79929fd1 | 181 | __start_parainstructions = .; |
139ec7c4 | 182 | *(.parainstructions) |
79929fd1 | 183 | __stop_parainstructions = .; |
139ec7c4 | 184 | } |
1da177e4 LT |
185 | /* .exit.text is discard at runtime, not link time, to deal with references |
186 | from .altinstructions and .eh_frame */ | |
ad0d75eb EB |
187 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
188 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } | |
67d38229 | 189 | #if defined(CONFIG_BLK_DEV_INITRD) |
1da177e4 | 190 | . = ALIGN(4096); |
6569580d VG |
191 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
192 | __initramfs_start = .; | |
193 | *(.init.ramfs) | |
194 | __initramfs_end = .; | |
195 | } | |
67d38229 | 196 | #endif |
379b5441 | 197 | . = ALIGN(L1_CACHE_BYTES); |
6569580d VG |
198 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
199 | __per_cpu_start = .; | |
200 | *(.data.percpu) | |
201 | __per_cpu_end = .; | |
202 | } | |
1da177e4 | 203 | . = ALIGN(4096); |
1da177e4 LT |
204 | /* freed after init ends here */ |
205 | ||
ad0d75eb | 206 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
6569580d VG |
207 | __init_end = .; |
208 | __bss_start = .; /* BSS */ | |
209 | *(.bss.page_aligned) | |
1da177e4 | 210 | *(.bss) |
6569580d VG |
211 | . = ALIGN(4); |
212 | __bss_stop = .; | |
213 | _end = . ; | |
214 | /* This is where the kernel creates the early boot page tables */ | |
215 | . = ALIGN(4096); | |
216 | pg0 = . ; | |
1da177e4 | 217 | } |
1da177e4 LT |
218 | |
219 | /* Sections to be discarded */ | |
220 | /DISCARD/ : { | |
221 | *(.exitcall.exit) | |
222 | } | |
223 | ||
a7d0c210 PBG |
224 | STABS_DEBUG |
225 | ||
226 | DWARF_DEBUG | |
9c9b8b38 JF |
227 | |
228 | NOTES | |
1da177e4 | 229 | } |