1 /* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
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.
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.
17 #define LOAD_OFFSET __PAGE_OFFSET
19 #include <asm-generic/vmlinux.lds.h>
20 #include <asm/thread_info.h>
22 #include <asm/cache.h>
25 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
27 ENTRY(phys_startup_32)
32 text PT_LOAD FLAGS(5); /* R_E */
33 data PT_LOAD FLAGS(7); /* RWE */
34 note PT_NOTE FLAGS(4); /* R__ */
38 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
39 phys_startup_32 = startup_32 - LOAD_OFFSET;
41 .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
42 _text = .; /* Text and read-only data */
47 .text : AT(ADDR(.text) - LOAD_OFFSET) {
54 _etext = .; /* End of text section */
57 . = ALIGN(16); /* Exception table */
58 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
59 __start___ex_table = .;
61 __stop___ex_table = .;
69 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
70 __tracedata_start = .;
77 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
82 .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
83 __start_paravirtprobe = .;
85 __stop_paravirtprobe = .;
89 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
97 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
102 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
103 *(.data.cacheline_aligned)
106 /* rarely changed data like cpu maps */
108 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
110 _edata = .; /* End of data section */
113 . = ALIGN(THREAD_SIZE); /* init_task */
114 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
118 /* might get freed after init */
120 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
122 __smp_alt_instructions = .;
123 *(.smp_altinstructions)
124 __smp_alt_instructions_end = .;
127 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
132 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
133 *(.smp_altinstr_replacement)
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.
144 /* will be freed after init */
145 . = ALIGN(4096); /* Init code and data */
146 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
152 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
154 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
159 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
160 __initcall_start = .;
164 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
165 __con_initcall_start = .;
166 *(.con_initcall.init)
167 __con_initcall_end = .;
171 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
172 __alt_instructions = .;
174 __alt_instructions_end = .;
176 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
177 *(.altinstr_replacement)
180 .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
181 __start_parainstructions = .;
183 __stop_parainstructions = .;
185 /* .exit.text is discard at runtime, not link time, to deal with references
186 from .altinstructions and .eh_frame */
187 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
188 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
189 #if defined(CONFIG_BLK_DEV_INITRD)
191 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
192 __initramfs_start = .;
197 . = ALIGN(L1_CACHE_BYTES);
198 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
204 /* freed after init ends here */
206 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
208 __bss_start = .; /* BSS */
214 /* This is where the kernel creates the early boot page tables */
219 /* Sections to be discarded */