1/* ld script to make x86-64 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 */
4OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
5OUTPUT_ARCH(i386:x86-64)
6ENTRY(_start)
7SECTIONS
8{
9  . = 0xffffffff80100000;
10  _text = .;			/* Text and read-only data */
11  .text : {
12	*(.text)
13	*(.fixup)
14	*(.gnu.warning)
15	} = 0x9090
16  .text.lock : { *(.text.lock) }	/* out-of-line lock text */
17
18  _etext = .;			/* End of text section */
19
20  .rodata : { *(.rodata) *(.rodata.*) }
21  .kstrtab : { *(.kstrtab) }
22
23  . = ALIGN(16);		/* Exception table */
24  __start___ex_table = .;
25  __ex_table : { *(__ex_table) }
26  __stop___ex_table = .;
27
28  __start___ksymtab = .;	/* Kernel symbol table */
29  __ksymtab : { *(__ksymtab) }
30  __stop___ksymtab = .;
31
32  __start___kallsyms = .;	/* All kernel symbols */
33  __kallsyms : { *(__kallsyms) }
34  __stop___kallsyms = .;
35
36  .data : {			/* Data */
37	*(.data)
38	CONSTRUCTORS
39	}
40
41  _edata = .;			/* End of data section */
42
43  __bss_start = .;		/* BSS */
44  .bss : {
45	*(.bss)
46	}
47  __bss_end = .;
48
49  . = ALIGN(64);
50  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
51
52  .vsyscall_0 -10*1024*1024: AT ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095)) { *(.vsyscall_0) }
53  __vsyscall_0 = LOADADDR(.vsyscall_0);
54  . = ALIGN(64);
55  .vxtime_sequence : AT ((LOADADDR(.vsyscall_0) + SIZEOF(.vsyscall_0) + 63) & ~(63)) { *(.vxtime_sequence) }
56  vxtime_sequence = LOADADDR(.vxtime_sequence);
57  . = ALIGN(16);
58  .vxtime : AT ((LOADADDR(.vxtime_sequence) + SIZEOF(.vxtime_sequence) + 15) & ~(15)) { *(.vxtime) }
59  vxtime = LOADADDR(.vxtime);
60  . = ALIGN(16);
61  .wall_jiffies : AT ((LOADADDR(.vxtime) + SIZEOF(.vxtime) + 15) & ~(15)) { *(.wall_jiffies) }
62  wall_jiffies = LOADADDR(.wall_jiffies);
63  . = ALIGN(16);
64  .sys_tz : AT ((LOADADDR(.wall_jiffies) + SIZEOF(.wall_jiffies) + 15) & ~(15)) { *(.sys_tz) }
65  sys_tz = LOADADDR(.sys_tz);
66  . = ALIGN(16);
67  .jiffies : AT ((LOADADDR(.sys_tz) + SIZEOF(.sys_tz) + 15) & ~(15)) { *(.jiffies) }
68  jiffies = LOADADDR(.jiffies);
69  . = ALIGN(16);
70  .xtime : AT ((LOADADDR(.jiffies) + SIZEOF(.jiffies) + 15) & ~(15)) { *(.xtime) }
71  xtime = LOADADDR(.xtime);
72  .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) }
73  . = LOADADDR(.vsyscall_0) + 4096;
74
75  . = ALIGN(8192);		/* init_task */
76  .data.init_task : { *(.data.init_task) }
77
78  . = ALIGN(4096);
79  .data.boot_pgt : { *(.data.boot_pgt) }
80
81  . = ALIGN(4096);		/* Init code and data */
82  __init_begin = .;
83  .text.init : { *(.text.init) }
84  .data.init : { *(.data.init) }
85  . = ALIGN(16);
86  __setup_start = .;
87  .setup.init : { *(.setup.init) }
88  __setup_end = .;
89  __initcall_start = .;
90  .initcall.init : { *(.initcall.init) }
91  __initcall_end = .;
92  . = ALIGN(4096);
93  __init_end = .;
94
95  _end = . ;
96
97  /* Sections to be discarded */
98  /DISCARD/ : {
99	*(.text.exit)
100	*(.data.exit)
101	*(.exitcall.exit)
102	*(.eh_frame)
103	}
104
105  /* DWARF 2 */
106  .debug_info     0 : { *(.debug_info) }
107  .debug_abbrev   0 : { *(.debug_abbrev) }
108  .debug_line     0 : { *(.debug_line) }
109  .debug_frame    0 : { *(.debug_frame) }
110  .debug_str      0 : { *(.debug_str) }
111  .debug_loc      0 : { *(.debug_loc) }
112  .debug_macinfo  0 : { *(.debug_macinfo) }
113  /* SGI/MIPS DWARF 2 extensions */
114  .debug_weaknames 0 : { *(.debug_weaknames) }
115  .debug_funcnames 0 : { *(.debug_funcnames) }
116  .debug_typenames 0 : { *(.debug_typenames) }
117  .debug_varnames  0 : { *(.debug_varnames) }
118
119
120  .comment 0 : { *(.comment) }
121}
122