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  .hpet : AT ((LOADADDR(.vxtime_sequence) + SIZEOF(.vxtime_sequence) + 15) & ~(15)) { *(.hpet) }
59  hpet = LOADADDR(.hpet);
60  . = ALIGN(16);
61  .wall_jiffies : AT ((LOADADDR(.hpet) + SIZEOF(.hpet) + 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	*(.data.exit)
100	*(.exitcall.exit)
101	}
102
103  /* DWARF 2 */
104  .debug_info     0 : { *(.debug_info) }
105  .debug_abbrev   0 : { *(.debug_abbrev) }
106  .debug_line     0 : { *(.debug_line) }
107  .debug_frame    0 : { *(.debug_frame) }
108  .debug_str      0 : { *(.debug_str) }
109  .debug_loc      0 : { *(.debug_loc) }
110  .debug_macinfo  0 : { *(.debug_macinfo) }
111  /* SGI/MIPS DWARF 2 extensions */
112  .debug_weaknames 0 : { *(.debug_weaknames) }
113  .debug_funcnames 0 : { *(.debug_funcnames) }
114  .debug_typenames 0 : { *(.debug_typenames) }
115  .debug_varnames  0 : { *(.debug_varnames) }
116
117
118  .comment 0 : { *(.comment) }
119}
120