vmlinux.lds.S 3.9 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4
/* ld script to make i386 Linux kernel
 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
 */

5 6
#define LOAD_OFFSET __PAGE_OFFSET

L
Linus Torvalds 已提交
7 8 9 10 11 12
#include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h>
#include <asm/page.h>

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
13
ENTRY(phys_startup_32)
L
Linus Torvalds 已提交
14 15 16
jiffies = jiffies_64;
SECTIONS
{
17
  . = __KERNEL_START;
18
  phys_startup_32 = startup_32 - LOAD_OFFSET;
L
Linus Torvalds 已提交
19 20
  /* read-only */
  _text = .;			/* Text and read-only data */
21
  .text : AT(ADDR(.text) - LOAD_OFFSET) {
L
Linus Torvalds 已提交
22 23 24
	*(.text)
	SCHED_TEXT
	LOCK_TEXT
25
	KPROBES_TEXT
L
Linus Torvalds 已提交
26 27 28 29 30 31 32 33
	*(.fixup)
	*(.gnu.warning)
	} = 0x9090

  _etext = .;			/* End of text section */

  . = ALIGN(16);		/* Exception table */
  __start___ex_table = .;
34
  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
L
Linus Torvalds 已提交
35 36 37 38 39
  __stop___ex_table = .;

  RODATA

  /* writeable */
40
  .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
L
Linus Torvalds 已提交
41 42 43 44 45 46
	*(.data)
	CONSTRUCTORS
	}

  . = ALIGN(4096);
  __nosave_begin = .;
47
  .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
L
Linus Torvalds 已提交
48 49 50 51
  . = ALIGN(4096);
  __nosave_end = .;

  . = ALIGN(4096);
52 53 54
  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
	*(.data.idt)
  }
L
Linus Torvalds 已提交
55 56

  . = ALIGN(32);
57 58 59
  .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
	*(.data.cacheline_aligned)
  }
L
Linus Torvalds 已提交
60

61 62 63
  /* rarely changed data like cpu maps */
  . = ALIGN(32);
  .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) }
L
Linus Torvalds 已提交
64 65 66
  _edata = .;			/* End of data section */

  . = ALIGN(THREAD_SIZE);	/* init_task */
67 68 69
  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
	*(.data.init_task)
  }
L
Linus Torvalds 已提交
70 71 72 73

  /* will be freed after init */
  . = ALIGN(4096);		/* Init code and data */
  __init_begin = .;
74
  .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
L
Linus Torvalds 已提交
75 76 77 78
	_sinittext = .;
	*(.init.text)
	_einittext = .;
  }
79
  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
L
Linus Torvalds 已提交
80 81
  . = ALIGN(16);
  __setup_start = .;
82
  .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
L
Linus Torvalds 已提交
83 84
  __setup_end = .;
  __initcall_start = .;
85
  .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
L
Linus Torvalds 已提交
86 87 88 89 90 91 92 93 94 95
	*(.initcall1.init) 
	*(.initcall2.init) 
	*(.initcall3.init) 
	*(.initcall4.init) 
	*(.initcall5.init) 
	*(.initcall6.init) 
	*(.initcall7.init)
  }
  __initcall_end = .;
  __con_initcall_start = .;
96 97 98
  .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
	*(.con_initcall.init)
  }
L
Linus Torvalds 已提交
99 100 101 102
  __con_initcall_end = .;
  SECURITY_INIT
  . = ALIGN(4);
  __alt_instructions = .;
103 104 105
  .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
	*(.altinstructions)
  }
L
Linus Torvalds 已提交
106
  __alt_instructions_end = .; 
107 108 109
  .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
	*(.altinstr_replacement)
  }
L
Linus Torvalds 已提交
110 111
  /* .exit.text is discard at runtime, not link time, to deal with references
     from .altinstructions and .eh_frame */
112 113
  .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
  .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
L
Linus Torvalds 已提交
114 115
  . = ALIGN(4096);
  __initramfs_start = .;
116
  .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
L
Linus Torvalds 已提交
117 118 119
  __initramfs_end = .;
  . = ALIGN(32);
  __per_cpu_start = .;
120
  .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
L
Linus Torvalds 已提交
121 122 123 124 125 126
  __per_cpu_end = .;
  . = ALIGN(4096);
  __init_end = .;
  /* freed after init ends here */
	
  __bss_start = .;		/* BSS */
127
  .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
L
Linus Torvalds 已提交
128
	*(.bss.page_aligned)
129 130
  }
  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
L
Linus Torvalds 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
	*(.bss)
  }
  . = ALIGN(4);
  __bss_stop = .; 

  _end = . ;

  /* This is where the kernel creates the early boot page tables */
  . = ALIGN(4096);
  pg0 = .;

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

  /* Stabs debugging sections.  */
  .stab 0 : { *(.stab) }
  .stabstr 0 : { *(.stabstr) }
  .stab.excl 0 : { *(.stab.excl) }
  .stab.exclstr 0 : { *(.stab.exclstr) }
  .stab.index 0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment 0 : { *(.comment) }
}