]>
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; |
9c9b8b38 JF |
29 | |
30 | PHDRS { | |
31 | text PT_LOAD FLAGS(5); /* R_E */ | |
32 | data PT_LOAD FLAGS(7); /* RWE */ | |
03df4f6e | 33 | note PT_NOTE FLAGS(0); /* ___ */ |
9c9b8b38 | 34 | } |
1da177e4 LT |
35 | SECTIONS |
36 | { | |
e69f202d | 37 | . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; |
ad0d75eb | 38 | phys_startup_32 = startup_32 - LOAD_OFFSET; |
f8657e1b VG |
39 | |
40 | .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) { | |
41 | _text = .; /* Text and read-only data */ | |
42 | *(.text.head) | |
43 | } :text = 0x9090 | |
44 | ||
1da177e4 | 45 | /* read-only */ |
ad0d75eb | 46 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
7664709b | 47 | TEXT_TEXT |
1da177e4 LT |
48 | SCHED_TEXT |
49 | LOCK_TEXT | |
3d97ae5b | 50 | KPROBES_TEXT |
1da177e4 LT |
51 | *(.fixup) |
52 | *(.gnu.warning) | |
6569580d VG |
53 | _etext = .; /* End of text section */ |
54 | } :text = 0x9090 | |
1da177e4 LT |
55 | |
56 | . = ALIGN(16); /* Exception table */ | |
6569580d VG |
57 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { |
58 | __start___ex_table = .; | |
59 | *(__ex_table) | |
60 | __stop___ex_table = .; | |
61 | } | |
1da177e4 | 62 | |
cbe87121 RM |
63 | NOTES :text :note |
64 | ||
65 | BUG_TABLE :text | |
91768d6c | 66 | |
eb71c87a | 67 | . = ALIGN(4); |
eb71c87a | 68 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { |
6569580d | 69 | __tracedata_start = .; |
eb71c87a | 70 | *(.tracedata) |
6569580d | 71 | __tracedata_end = .; |
eb71c87a | 72 | } |
eb71c87a | 73 | |
6fb14755 JB |
74 | RODATA |
75 | ||
1da177e4 | 76 | /* writeable */ |
c06cb8b1 | 77 | . = ALIGN(4096); |
ad0d75eb | 78 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
ca967258 | 79 | DATA_DATA |
1da177e4 | 80 | CONSTRUCTORS |
9c9b8b38 | 81 | } :data |
1da177e4 LT |
82 | |
83 | . = ALIGN(4096); | |
6569580d VG |
84 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
85 | __nosave_begin = .; | |
86 | *(.data.nosave) | |
87 | . = ALIGN(4096); | |
88 | __nosave_end = .; | |
89 | } | |
1da177e4 LT |
90 | |
91 | . = ALIGN(4096); | |
ad0d75eb | 92 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
5ead97c8 | 93 | *(.data.page_aligned) |
ad0d75eb EB |
94 | *(.data.idt) |
95 | } | |
1da177e4 LT |
96 | |
97 | . = ALIGN(32); | |
ad0d75eb EB |
98 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
99 | *(.data.cacheline_aligned) | |
100 | } | |
1da177e4 | 101 | |
6c036527 CL |
102 | /* rarely changed data like cpu maps */ |
103 | . = ALIGN(32); | |
6569580d VG |
104 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { |
105 | *(.data.read_mostly) | |
106 | _edata = .; /* End of data section */ | |
107 | } | |
1da177e4 LT |
108 | |
109 | . = ALIGN(THREAD_SIZE); /* init_task */ | |
ad0d75eb EB |
110 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
111 | *(.data.init_task) | |
112 | } | |
1da177e4 | 113 | |
9a0b5817 GH |
114 | /* might get freed after init */ |
115 | . = ALIGN(4096); | |
9a0b5817 | 116 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { |
6569580d | 117 | __smp_locks = .; |
9a0b5817 | 118 | *(.smp_locks) |
6569580d | 119 | __smp_locks_end = .; |
9a0b5817 | 120 | } |
6ed01884 VG |
121 | /* will be freed after init |
122 | * Following ALIGN() is required to make sure no other data falls on the | |
123 | * same page where __smp_alt_end is pointing as that page might be freed | |
124 | * after boot. Always make sure that ALIGN() directive is present after | |
125 | * the section which contains __smp_alt_end. | |
126 | */ | |
9a0b5817 | 127 | . = ALIGN(4096); |
9a0b5817 | 128 | |
1da177e4 LT |
129 | /* will be freed after init */ |
130 | . = ALIGN(4096); /* Init code and data */ | |
ad0d75eb | 131 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
6569580d | 132 | __init_begin = .; |
1da177e4 LT |
133 | _sinittext = .; |
134 | *(.init.text) | |
135 | _einittext = .; | |
136 | } | |
ad0d75eb | 137 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
1da177e4 | 138 | . = ALIGN(16); |
6569580d VG |
139 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
140 | __setup_start = .; | |
141 | *(.init.setup) | |
142 | __setup_end = .; | |
143 | } | |
ad0d75eb | 144 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
6569580d | 145 | __initcall_start = .; |
61ce1efe | 146 | INITCALLS |
6569580d | 147 | __initcall_end = .; |
1da177e4 | 148 | } |
ad0d75eb | 149 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
6569580d | 150 | __con_initcall_start = .; |
ad0d75eb | 151 | *(.con_initcall.init) |
6569580d | 152 | __con_initcall_end = .; |
ad0d75eb | 153 | } |
1da177e4 LT |
154 | SECURITY_INIT |
155 | . = ALIGN(4); | |
ad0d75eb | 156 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
6569580d | 157 | __alt_instructions = .; |
ad0d75eb | 158 | *(.altinstructions) |
6569580d | 159 | __alt_instructions_end = .; |
ad0d75eb | 160 | } |
ad0d75eb EB |
161 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
162 | *(.altinstr_replacement) | |
163 | } | |
139ec7c4 | 164 | . = ALIGN(4); |
139ec7c4 | 165 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { |
441d40dc | 166 | __parainstructions = .; |
139ec7c4 | 167 | *(.parainstructions) |
441d40dc | 168 | __parainstructions_end = .; |
139ec7c4 | 169 | } |
1da177e4 LT |
170 | /* .exit.text is discard at runtime, not link time, to deal with references |
171 | from .altinstructions and .eh_frame */ | |
ad0d75eb EB |
172 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
173 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } | |
67d38229 | 174 | #if defined(CONFIG_BLK_DEV_INITRD) |
1da177e4 | 175 | . = ALIGN(4096); |
6569580d VG |
176 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
177 | __initramfs_start = .; | |
178 | *(.init.ramfs) | |
179 | __initramfs_end = .; | |
180 | } | |
67d38229 | 181 | #endif |
b6e3590f | 182 | . = ALIGN(4096); |
6569580d VG |
183 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
184 | __per_cpu_start = .; | |
185 | *(.data.percpu) | |
5fb7dc37 | 186 | *(.data.percpu.shared_aligned) |
6569580d VG |
187 | __per_cpu_end = .; |
188 | } | |
1da177e4 | 189 | . = ALIGN(4096); |
1da177e4 LT |
190 | /* freed after init ends here */ |
191 | ||
ad0d75eb | 192 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
6569580d VG |
193 | __init_end = .; |
194 | __bss_start = .; /* BSS */ | |
195 | *(.bss.page_aligned) | |
1da177e4 | 196 | *(.bss) |
6569580d VG |
197 | . = ALIGN(4); |
198 | __bss_stop = .; | |
199 | _end = . ; | |
200 | /* This is where the kernel creates the early boot page tables */ | |
201 | . = ALIGN(4096); | |
202 | pg0 = . ; | |
1da177e4 | 203 | } |
1da177e4 LT |
204 | |
205 | /* Sections to be discarded */ | |
206 | /DISCARD/ : { | |
207 | *(.exitcall.exit) | |
208 | } | |
209 | ||
a7d0c210 PBG |
210 | STABS_DEBUG |
211 | ||
212 | DWARF_DEBUG | |
1da177e4 | 213 | } |