]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/kernel/vmlinux_32.lds.S
all archs: consolidate init and exit sections in vmlinux.lds.h
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / vmlinux_32.lds.S
CommitLineData
a60b778b
TG
1/* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
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.
9 */
10
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 */
17#define LOAD_OFFSET __PAGE_OFFSET
18
19#include <asm-generic/vmlinux.lds.h>
20#include <asm/thread_info.h>
21#include <asm/page.h>
22#include <asm/cache.h>
23#include <asm/boot.h>
24
25OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
26OUTPUT_ARCH(i386)
27ENTRY(phys_startup_32)
28jiffies = jiffies_64;
29
30PHDRS {
31 text PT_LOAD FLAGS(5); /* R_E */
32 data PT_LOAD FLAGS(7); /* RWE */
33 note PT_NOTE FLAGS(0); /* ___ */
34}
35SECTIONS
36{
37 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
38 phys_startup_32 = startup_32 - LOAD_OFFSET;
39
40 .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
41 _text = .; /* Text and read-only data */
42 *(.text.head)
43 } :text = 0x9090
44
45 /* read-only */
46 .text : AT(ADDR(.text) - LOAD_OFFSET) {
47 TEXT_TEXT
48 SCHED_TEXT
49 LOCK_TEXT
50 KPROBES_TEXT
51 *(.fixup)
52 *(.gnu.warning)
53 _etext = .; /* End of text section */
54 } :text = 0x9090
55
56 . = ALIGN(16); /* Exception table */
57 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
58 __start___ex_table = .;
59 *(__ex_table)
60 __stop___ex_table = .;
61 }
62
63 NOTES :text :note
64
65 BUG_TABLE :text
66
67 . = ALIGN(4);
68 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
69 __tracedata_start = .;
70 *(.tracedata)
71 __tracedata_end = .;
72 }
73
74 RODATA
75
76 /* writeable */
77 . = ALIGN(4096);
78 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
79 DATA_DATA
80 CONSTRUCTORS
81 } :data
82
83 . = ALIGN(4096);
84 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
85 __nosave_begin = .;
86 *(.data.nosave)
87 . = ALIGN(4096);
88 __nosave_end = .;
89 }
90
91 . = ALIGN(4096);
92 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
93 *(.data.page_aligned)
94 *(.data.idt)
95 }
96
97 . = ALIGN(32);
98 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
99 *(.data.cacheline_aligned)
100 }
101
102 /* rarely changed data like cpu maps */
103 . = ALIGN(32);
104 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
105 *(.data.read_mostly)
106 _edata = .; /* End of data section */
107 }
108
109 . = ALIGN(THREAD_SIZE); /* init_task */
110 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
111 *(.data.init_task)
112 }
113
114 /* might get freed after init */
115 . = ALIGN(4096);
116 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
117 __smp_locks = .;
118 *(.smp_locks)
119 __smp_locks_end = .;
120 }
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 */
127 . = ALIGN(4096);
128
129 /* will be freed after init */
130 . = ALIGN(4096); /* Init code and data */
131 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
132 __init_begin = .;
133 _sinittext = .;
01ba2bdc 134 INIT_TEXT
a60b778b
TG
135 _einittext = .;
136 }
01ba2bdc
SR
137 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
138 INIT_DATA
139 }
a60b778b
TG
140 . = ALIGN(16);
141 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
142 __setup_start = .;
143 *(.init.setup)
144 __setup_end = .;
145 }
146 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
147 __initcall_start = .;
148 INITCALLS
149 __initcall_end = .;
150 }
151 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
152 __con_initcall_start = .;
153 *(.con_initcall.init)
154 __con_initcall_end = .;
155 }
156 SECURITY_INIT
157 . = ALIGN(4);
158 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
159 __alt_instructions = .;
160 *(.altinstructions)
161 __alt_instructions_end = .;
162 }
163 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
164 *(.altinstr_replacement)
165 }
166 . = ALIGN(4);
167 .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
168 __parainstructions = .;
169 *(.parainstructions)
170 __parainstructions_end = .;
171 }
172 /* .exit.text is discard at runtime, not link time, to deal with references
173 from .altinstructions and .eh_frame */
01ba2bdc
SR
174 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
175 EXIT_TEXT
176 }
177 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
178 EXIT_DATA
179 }
a60b778b
TG
180#if defined(CONFIG_BLK_DEV_INITRD)
181 . = ALIGN(4096);
182 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
183 __initramfs_start = .;
184 *(.init.ramfs)
185 __initramfs_end = .;
186 }
187#endif
188 . = ALIGN(4096);
189 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
190 __per_cpu_start = .;
191 *(.data.percpu)
192 *(.data.percpu.shared_aligned)
193 __per_cpu_end = .;
194 }
195 . = ALIGN(4096);
196 /* freed after init ends here */
197
198 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
199 __init_end = .;
200 __bss_start = .; /* BSS */
201 *(.bss.page_aligned)
202 *(.bss)
203 . = ALIGN(4);
204 __bss_stop = .;
205 _end = . ;
206 /* This is where the kernel creates the early boot page tables */
207 . = ALIGN(4096);
208 pg0 = . ;
209 }
210
211 /* Sections to be discarded */
212 /DISCARD/ : {
213 *(.exitcall.exit)
214 }
215
216 STABS_DEBUG
217
218 DWARF_DEBUG
219}