1 /* ld script to make x86-64 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
5 #define LOAD_OFFSET __START_KERNEL_map
7 #include <asm-generic/vmlinux.lds.h>
9 #include <linux/config.h>
11 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
12 OUTPUT_ARCH(i386:x86-64)
13 ENTRY(phys_startup_64)
18 phys_startup_64 = startup_64 - LOAD_OFFSET;
19 _text = .; /* Text and read-only data */
20 .text : AT(ADDR(.text) - LOAD_OFFSET) {
28 /* out-of-line lock text */
29 .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
31 _etext = .; /* End of text section */
33 . = ALIGN(16); /* Exception table */
34 __start___ex_table = .;
35 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
36 __stop___ex_table = .;
41 .data : AT(ADDR(.data) - LOAD_OFFSET) {
46 _edata = .; /* End of data section */
48 __bss_start = .; /* BSS */
49 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
56 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
57 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
58 *(.data.cacheline_aligned)
60 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
61 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
65 #define VSYSCALL_ADDR (-10*1024*1024)
66 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
67 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
69 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
70 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
72 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
73 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
76 .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
77 __vsyscall_0 = VSYSCALL_VIRT_ADDR;
79 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
80 .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
81 xtime_lock = VVIRT(.xtime_lock);
83 .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
84 vxtime = VVIRT(.vxtime);
86 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
87 wall_jiffies = VVIRT(.wall_jiffies);
89 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
90 sys_tz = VVIRT(.sys_tz);
92 .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
93 sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
95 .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
96 xtime = VVIRT(.xtime);
98 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
99 .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
100 jiffies = VVIRT(.jiffies);
102 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) }
103 .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) }
104 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
106 . = VSYSCALL_VIRT_ADDR + 4096;
109 #undef VSYSCALL_PHYS_ADDR
110 #undef VSYSCALL_VIRT_ADDR
116 . = ALIGN(8192); /* init_task */
117 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
122 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
123 *(.data.page_aligned)
126 . = ALIGN(4096); /* Init code and data */
128 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
133 __initdata_begin = .;
134 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
138 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
140 __initcall_start = .;
141 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
151 __con_initcall_start = .;
152 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
153 *(.con_initcall.init)
155 __con_initcall_end = .;
158 __alt_instructions = .;
159 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
162 __alt_instructions_end = .;
163 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
164 *(.altinstr_replacement)
166 /* .exit.text is discard at runtime, not link time, to deal with references
167 from .altinstructions and .eh_frame */
168 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
169 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
171 __initramfs_start = .;
172 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
176 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
183 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
189 /* Sections to be discarded */
192 #ifndef CONFIG_DEBUG_INFO
198 .debug_info 0 : { *(.debug_info) }
199 .debug_abbrev 0 : { *(.debug_abbrev) }
200 .debug_line 0 : { *(.debug_line) }
201 .debug_frame 0 : { *(.debug_frame) }
202 .debug_str 0 : { *(.debug_str) }
203 .debug_loc 0 : { *(.debug_loc) }
204 .debug_macinfo 0 : { *(.debug_macinfo) }
205 /* SGI/MIPS DWARF 2 extensions */
206 .debug_weaknames 0 : { *(.debug_weaknames) }
207 .debug_funcnames 0 : { *(.debug_funcnames) }
208 .debug_typenames 0 : { *(.debug_typenames) }
209 .debug_varnames 0 : { *(.debug_varnames) }
212 .comment 0 : { *(.comment) }