vmlinux.lds.S 5.3 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
#define LOAD_OFFSET __PAGE_OFFSET

L
Linus Torvalds 已提交
13 14 15
#include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h>
#include <asm/page.h>
16
#include <asm/cache.h>
17
#include <asm/boot.h>
L
Linus Torvalds 已提交
18 19 20

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
21
ENTRY(phys_startup_32)
L
Linus Torvalds 已提交
22
jiffies = jiffies_64;
23 24 25 26 27 28

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

  . = ALIGN(16);		/* Exception table */
46 47 48 49 50
  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  	__start___ex_table = .;
	 *(__ex_table)
  	__stop___ex_table = .;
  }
L
Linus Torvalds 已提交
51 52 53

  RODATA

54 55
  . = ALIGN(4);
  .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
56
  	__tracedata_start = .;
57
	*(.tracedata)
58
  	__tracedata_end = .;
59 60
  }

L
Linus Torvalds 已提交
61
  /* writeable */
62
  . = ALIGN(4096);
63
  .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
L
Linus Torvalds 已提交
64 65
	*(.data)
	CONSTRUCTORS
66
	} :data
L
Linus Torvalds 已提交
67 68

  . = ALIGN(4096);
69 70 71 72 73 74
  .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  	__nosave_begin = .;
	*(.data.nosave)
  	. = ALIGN(4096);
  	__nosave_end = .;
  }
L
Linus Torvalds 已提交
75 76

  . = ALIGN(4096);
77 78 79
  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
	*(.data.idt)
  }
L
Linus Torvalds 已提交
80 81

  . = ALIGN(32);
82 83 84
  .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
	*(.data.cacheline_aligned)
  }
L
Linus Torvalds 已提交
85

86 87
  /* rarely changed data like cpu maps */
  . = ALIGN(32);
88 89 90 91
  .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
	*(.data.read_mostly)
	_edata = .;		/* End of data section */
  }
L
Linus Torvalds 已提交
92

93 94 95 96 97 98 99 100 101
#ifdef CONFIG_STACK_UNWIND
  . = ALIGN(4);
  .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) {
	__start_unwind = .;
  	*(.eh_frame)
	__end_unwind = .;
  }
#endif

L
Linus Torvalds 已提交
102
  . = ALIGN(THREAD_SIZE);	/* init_task */
103 104 105
  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
	*(.data.init_task)
  }
L
Linus Torvalds 已提交
106

G
Gerd Hoffmann 已提交
107 108 109
  /* might get freed after init */
  . = ALIGN(4096);
  .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
110 111
	__smp_alt_begin = .;
	__smp_alt_instructions = .;
G
Gerd Hoffmann 已提交
112
	*(.smp_altinstructions)
113
	__smp_alt_instructions_end = .;
G
Gerd Hoffmann 已提交
114 115 116
  }
  . = ALIGN(4);
  .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
117
  	__smp_locks = .;
G
Gerd Hoffmann 已提交
118
	*(.smp_locks)
119
	__smp_locks_end = .;
G
Gerd Hoffmann 已提交
120 121 122
  }
  .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
	*(.smp_altinstr_replacement)
123
  	__smp_alt_end = .;
G
Gerd Hoffmann 已提交
124
  }
125 126 127 128 129 130
  /* 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 已提交
131 132
  . = ALIGN(4096);

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

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

211 212 213
  STABS_DEBUG

  DWARF_DEBUG
214 215

  NOTES
L
Linus Torvalds 已提交
216
}