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 #define LOAD_OFFSET __PAGE_OFFSET
13 #include <asm-generic/vmlinux.lds.h>
14 #include <asm/thread_info.h>
16 #include <asm/cache.h>
19 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
21 ENTRY(phys_startup_32)
25 text PT_LOAD FLAGS(5); /* R_E */
26 data PT_LOAD FLAGS(7); /* RWE */
27 note PT_NOTE FLAGS(0); /* ___ */
31 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
32 phys_startup_32 = startup_32 - LOAD_OFFSET;
34 .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
35 _text = .; /* Text and read-only data */
40 .text : AT(ADDR(.text) - LOAD_OFFSET) {
41 . = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
49 _etext = .; /* End of text section */
54 . = ALIGN(16); /* Exception table */
55 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
56 __start___ex_table = .;
58 __stop___ex_table = .;
65 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
71 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
79 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
85 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
86 *(.data.cacheline_aligned)
89 /* rarely changed data like cpu maps */
91 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
93 _edata = .; /* End of data section */
96 . = ALIGN(THREAD_SIZE); /* init_task */
97 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
101 /* might get freed after init */
102 . = ALIGN(PAGE_SIZE);
103 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
108 /* will be freed after init
109 * Following ALIGN() is required to make sure no other data falls on the
110 * same page where __smp_alt_end is pointing as that page might be freed
111 * after boot. Always make sure that ALIGN() directive is present after
112 * the section which contains __smp_alt_end.
114 . = ALIGN(PAGE_SIZE);
116 /* will be freed after init */
117 . = ALIGN(PAGE_SIZE); /* Init code and data */
118 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
124 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
128 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
133 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
134 __initcall_start = .;
138 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
139 __con_initcall_start = .;
140 *(.con_initcall.init)
141 __con_initcall_end = .;
143 .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) {
144 __x86cpuvendor_start = .;
145 *(.x86cpuvendor.init)
146 __x86cpuvendor_end = .;
150 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
151 __alt_instructions = .;
153 __alt_instructions_end = .;
155 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
156 *(.altinstr_replacement)
159 .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
160 __parainstructions = .;
162 __parainstructions_end = .;
164 /* .exit.text is discard at runtime, not link time, to deal with references
165 from .altinstructions and .eh_frame */
166 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
169 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
172 #if defined(CONFIG_BLK_DEV_INITRD)
173 . = ALIGN(PAGE_SIZE);
174 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
175 __initramfs_start = .;
180 . = ALIGN(PAGE_SIZE);
181 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
184 *(.data.percpu.shared_aligned)
187 . = ALIGN(PAGE_SIZE);
188 /* freed after init ends here */
190 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
192 __bss_start = .; /* BSS */
198 /* This is where the kernel creates the early boot page tables */
199 . = ALIGN(PAGE_SIZE);
203 /* Sections to be discarded */