vmlinux.lds.S 5.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/* ld script to make i386 Linux kernel
 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 4 5 6 7 8
 *
 * Don't define absolute symbols until and unless you know that symbol
 * value is should remain constant even if kernel image is relocated
 * at run time. Absolute symbols are not relocated. If symbol value should
 * change if kernel is relocated, make the symbol section relative and
 * put it inside the section definition.
L
Linus Torvalds 已提交
9 10
 */

11 12 13 14 15 16
/* Don't define absolute symbols until and unless you know that symbol
 * value is should remain constant even if kernel image is relocated
 * at run time. Absolute symbols are not relocated. If symbol value should
 * change if kernel is relocated, make the symbol section relative and
 * put it inside the section definition.
 */
17 18
#define LOAD_OFFSET __PAGE_OFFSET

L
Linus Torvalds 已提交
19 20 21
#include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h>
#include <asm/page.h>
22
#include <asm/cache.h>
23
#include <asm/boot.h>
L
Linus Torvalds 已提交
24 25 26

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
27
ENTRY(phys_startup_32)
L
Linus Torvalds 已提交
28
jiffies = jiffies_64;
29
_proxy_pda = 0;
30 31 32 33 34 35

PHDRS {
	text PT_LOAD FLAGS(5);	/* R_E */
	data PT_LOAD FLAGS(7);	/* RWE */
	note PT_NOTE FLAGS(4);	/* R__ */
}
L
Linus Torvalds 已提交
36 37
SECTIONS
{
38
  . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
39
  phys_startup_32 = startup_32 - LOAD_OFFSET;
L
Linus Torvalds 已提交
40
  /* read-only */
41
  .text : AT(ADDR(.text) - LOAD_OFFSET) {
42
  	_text = .;			/* Text and read-only data */
L
Linus Torvalds 已提交
43 44 45
	*(.text)
	SCHED_TEXT
	LOCK_TEXT
46
	KPROBES_TEXT
L
Linus Torvalds 已提交
47 48
	*(.fixup)
	*(.gnu.warning)
49 50
  	_etext = .;			/* End of text section */
  } :text = 0x9090
L
Linus Torvalds 已提交
51 52

  . = ALIGN(16);		/* Exception table */
53 54 55 56 57
  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  	__start___ex_table = .;
	 *(__ex_table)
  	__stop___ex_table = .;
  }
L
Linus Torvalds 已提交
58 59 60

  RODATA

J
Jeremy Fitzhardinge 已提交
61 62
  BUG_TABLE

63 64
  . = ALIGN(4);
  .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
65
  	__tracedata_start = .;
66
	*(.tracedata)
67
  	__tracedata_end = .;
68 69
  }

L
Linus Torvalds 已提交
70
  /* writeable */
71
  . = ALIGN(4096);
72
  .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
L
Linus Torvalds 已提交
73 74
	*(.data)
	CONSTRUCTORS
75
	} :data
L
Linus Torvalds 已提交
76

77
  .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
78
  	__start_paravirtprobe = .;
79
	*(.paravirtprobe)
80
  	__stop_paravirtprobe = .;
81 82
  }

L
Linus Torvalds 已提交
83
  . = ALIGN(4096);
84 85 86 87 88 89
  .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  	__nosave_begin = .;
	*(.data.nosave)
  	. = ALIGN(4096);
  	__nosave_end = .;
  }
L
Linus Torvalds 已提交
90 91

  . = ALIGN(4096);
92 93 94
  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
	*(.data.idt)
  }
L
Linus Torvalds 已提交
95 96

  . = ALIGN(32);
97 98 99
  .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
	*(.data.cacheline_aligned)
  }
L
Linus Torvalds 已提交
100

101 102
  /* rarely changed data like cpu maps */
  . = ALIGN(32);
103 104 105 106
  .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
	*(.data.read_mostly)
	_edata = .;		/* End of data section */
  }
L
Linus Torvalds 已提交
107 108

  . = ALIGN(THREAD_SIZE);	/* init_task */
109 110 111
  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
	*(.data.init_task)
  }
L
Linus Torvalds 已提交
112

G
Gerd Hoffmann 已提交
113 114 115
  /* might get freed after init */
  . = ALIGN(4096);
  .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
116 117
	__smp_alt_begin = .;
	__smp_alt_instructions = .;
G
Gerd Hoffmann 已提交
118
	*(.smp_altinstructions)
119
	__smp_alt_instructions_end = .;
G
Gerd Hoffmann 已提交
120 121 122
  }
  . = ALIGN(4);
  .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
123
  	__smp_locks = .;
G
Gerd Hoffmann 已提交
124
	*(.smp_locks)
125
	__smp_locks_end = .;
G
Gerd Hoffmann 已提交
126 127 128
  }
  .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
	*(.smp_altinstr_replacement)
129
  	__smp_alt_end = .;
G
Gerd Hoffmann 已提交
130
  }
131 132 133 134 135 136
  /* will be freed after init
   * Following ALIGN() is required to make sure no other data falls on the
   * same page where __smp_alt_end is pointing as that page might be freed
   * after boot. Always make sure that ALIGN() directive is present after
   * the section which contains __smp_alt_end.
   */
G
Gerd Hoffmann 已提交
137 138
  . = ALIGN(4096);

L
Linus Torvalds 已提交
139 140
  /* will be freed after init */
  . = ALIGN(4096);		/* Init code and data */
141
  .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
142
  	__init_begin = .;
L
Linus Torvalds 已提交
143 144 145 146
	_sinittext = .;
	*(.init.text)
	_einittext = .;
  }
147
  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
L
Linus Torvalds 已提交
148
  . = ALIGN(16);
149 150 151 152 153
  .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
  	__setup_start = .;
	*(.init.setup)
  	__setup_end = .;
   }
154
  .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
155
  	__initcall_start = .;
156
	INITCALLS
157
  	__initcall_end = .;
L
Linus Torvalds 已提交
158
  }
159
  .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
160
  	__con_initcall_start = .;
161
	*(.con_initcall.init)
162
  	__con_initcall_end = .;
163
  }
L
Linus Torvalds 已提交
164 165
  SECURITY_INIT
  . = ALIGN(4);
166
  .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
167
  	__alt_instructions = .;
168
	*(.altinstructions)
169
	__alt_instructions_end = .;
170 171 172 173
  }
  .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
	*(.altinstr_replacement)
  }
174 175
  . = ALIGN(4);
  .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
176
  	__start_parainstructions = .;
177
	*(.parainstructions)
178
  	__stop_parainstructions = .;
179
  }
L
Linus Torvalds 已提交
180 181
  /* .exit.text is discard at runtime, not link time, to deal with references
     from .altinstructions and .eh_frame */
182 183
  .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
  .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
L
Linus Torvalds 已提交
184
  . = ALIGN(4096);
185 186 187 188 189
  .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
	__initramfs_start = .;
	*(.init.ramfs)
	__initramfs_end = .;
  }
190
  . = ALIGN(L1_CACHE_BYTES);
191 192 193 194 195
  .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
	__per_cpu_start = .;
	*(.data.percpu)
	__per_cpu_end = .;
  }
L
Linus Torvalds 已提交
196 197 198
  . = ALIGN(4096);
  /* freed after init ends here */
	
199
  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
200 201 202
	__init_end = .;
	__bss_start = .;		/* BSS */
	*(.bss.page_aligned)
L
Linus Torvalds 已提交
203
	*(.bss)
204 205 206 207 208 209
	. = ALIGN(4);
	__bss_stop = .;
  	_end = . ;
	/* This is where the kernel creates the early boot page tables */
	. = ALIGN(4096);
	pg0 = . ;
L
Linus Torvalds 已提交
210 211 212 213 214 215 216
  }

  /* Sections to be discarded */
  /DISCARD/ : {
	*(.exitcall.exit)
	}

217 218 219
  STABS_DEBUG

  DWARF_DEBUG
220 221

  NOTES
L
Linus Torvalds 已提交
222
}