vmlinux.lds.S 3.8 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 18
  . = LOAD_OFFSET + 0x100000;
  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 25 26 27 28 29 30 31 32
	*(.text)
	SCHED_TEXT
	LOCK_TEXT
	*(.fixup)
	*(.gnu.warning)
	} = 0x9090

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

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

  RODATA

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

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

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

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

  _edata = .;			/* End of data section */

  . = ALIGN(THREAD_SIZE);	/* init_task */
63 64 65
  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
	*(.data.init_task)
  }
L
Linus Torvalds 已提交
66 67 68 69

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