]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - arch/x86_64/kernel/vmlinux.lds.S
[PATCH] kexec: x86_64: vmlinux: fix physical addresses
[mirror_ubuntu-zesty-kernel.git] / arch / x86_64 / kernel / vmlinux.lds.S
1 /* ld script to make x86-64 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 */
4
5 #define LOAD_OFFSET __START_KERNEL_map
6
7 #include <asm-generic/vmlinux.lds.h>
8 #include <asm/page.h>
9 #include <linux/config.h>
10
11 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
12 OUTPUT_ARCH(i386:x86-64)
13 ENTRY(phys_startup_64)
14 jiffies_64 = jiffies;
15 SECTIONS
16 {
17 . = __START_KERNEL;
18 phys_startup_64 = startup_64 - LOAD_OFFSET;
19 _text = .; /* Text and read-only data */
20 .text : AT(ADDR(.text) - LOAD_OFFSET) {
21 *(.text)
22 SCHED_TEXT
23 LOCK_TEXT
24 *(.fixup)
25 *(.gnu.warning)
26 } = 0x9090
27 /* out-of-line lock text */
28 .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
29
30 _etext = .; /* End of text section */
31
32 . = ALIGN(16); /* Exception table */
33 __start___ex_table = .;
34 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
35 __stop___ex_table = .;
36
37 RODATA
38
39 /* Data */
40 .data : AT(ADDR(.data) - LOAD_OFFSET) {
41 *(.data)
42 CONSTRUCTORS
43 }
44
45 _edata = .; /* End of data section */
46
47 __bss_start = .; /* BSS */
48 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
49 *(.bss.page_aligned)
50 *(.bss)
51 }
52 __bss_end = .;
53
54 . = ALIGN(PAGE_SIZE);
55 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
56 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
57 *(.data.cacheline_aligned)
58 }
59
60 #define VSYSCALL_ADDR (-10*1024*1024)
61 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095))
62 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095))
63
64 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
65 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
66
67 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
68 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
69
70 . = VSYSCALL_ADDR;
71 .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
72 __vsyscall_0 = VSYSCALL_VIRT_ADDR;
73
74 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
75 .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
76 xtime_lock = VVIRT(.xtime_lock);
77
78 .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
79 vxtime = VVIRT(.vxtime);
80
81 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
82 wall_jiffies = VVIRT(.wall_jiffies);
83
84 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
85 sys_tz = VVIRT(.sys_tz);
86
87 .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
88 sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
89
90 .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
91 xtime = VVIRT(.xtime);
92
93 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
94 .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
95 jiffies = VVIRT(.jiffies);
96
97 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) }
98 .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) }
99 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
100
101 . = VSYSCALL_VIRT_ADDR + 4096;
102
103 #undef VSYSCALL_ADDR
104 #undef VSYSCALL_PHYS_ADDR
105 #undef VSYSCALL_VIRT_ADDR
106 #undef VLOAD_OFFSET
107 #undef VLOAD
108 #undef VVIRT_OFFSET
109 #undef VVIRT
110
111 . = ALIGN(8192); /* init_task */
112 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
113 *(.data.init_task)
114 }
115
116 . = ALIGN(4096);
117 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
118 *(.data.page_aligned)
119 }
120
121 . = ALIGN(4096); /* Init code and data */
122 __init_begin = .;
123 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
124 _sinittext = .;
125 *(.init.text)
126 _einittext = .;
127 }
128 __initdata_begin = .;
129 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
130 __initdata_end = .;
131 . = ALIGN(16);
132 __setup_start = .;
133 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
134 __setup_end = .;
135 __initcall_start = .;
136 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
137 *(.initcall1.init)
138 *(.initcall2.init)
139 *(.initcall3.init)
140 *(.initcall4.init)
141 *(.initcall5.init)
142 *(.initcall6.init)
143 *(.initcall7.init)
144 }
145 __initcall_end = .;
146 __con_initcall_start = .;
147 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
148 *(.con_initcall.init)
149 }
150 __con_initcall_end = .;
151 SECURITY_INIT
152 . = ALIGN(8);
153 __alt_instructions = .;
154 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
155 *(.altinstructions)
156 }
157 __alt_instructions_end = .;
158 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
159 *(.altinstr_replacement)
160 }
161 /* .exit.text is discard at runtime, not link time, to deal with references
162 from .altinstructions and .eh_frame */
163 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
164 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
165 . = ALIGN(4096);
166 __initramfs_start = .;
167 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
168 __initramfs_end = .;
169 . = ALIGN(32);
170 __per_cpu_start = .;
171 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
172 __per_cpu_end = .;
173 . = ALIGN(4096);
174 __init_end = .;
175
176 . = ALIGN(4096);
177 __nosave_begin = .;
178 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
179 . = ALIGN(4096);
180 __nosave_end = .;
181
182 _end = . ;
183
184 /* Sections to be discarded */
185 /DISCARD/ : {
186 *(.exitcall.exit)
187 #ifndef CONFIG_DEBUG_INFO
188 *(.eh_frame)
189 #endif
190 }
191
192 /* DWARF 2 */
193 .debug_info 0 : { *(.debug_info) }
194 .debug_abbrev 0 : { *(.debug_abbrev) }
195 .debug_line 0 : { *(.debug_line) }
196 .debug_frame 0 : { *(.debug_frame) }
197 .debug_str 0 : { *(.debug_str) }
198 .debug_loc 0 : { *(.debug_loc) }
199 .debug_macinfo 0 : { *(.debug_macinfo) }
200 /* SGI/MIPS DWARF 2 extensions */
201 .debug_weaknames 0 : { *(.debug_weaknames) }
202 .debug_funcnames 0 : { *(.debug_funcnames) }
203 .debug_typenames 0 : { *(.debug_typenames) }
204 .debug_varnames 0 : { *(.debug_varnames) }
205
206
207 .comment 0 : { *(.comment) }
208 }