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) {
27 /* out-of-line lock text */
28 .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) }
30 _etext = .; /* End of text section */
32 . = ALIGN(16); /* Exception table */
33 __start___ex_table = .;
34 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
35 __stop___ex_table = .;
40 .data : AT(ADDR(.data) - LOAD_OFFSET) {
45 _edata = .; /* End of data section */
47 __bss_start = .; /* BSS */
48 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
55 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
56 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
57 *(.data.cacheline_aligned)
59 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
60 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
64 #define VSYSCALL_ADDR (-10*1024*1024)
65 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
66 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
68 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
69 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
71 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
72 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
75 .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
76 __vsyscall_0 = VSYSCALL_VIRT_ADDR;
78 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
79 .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
80 xtime_lock = VVIRT(.xtime_lock);
82 .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
83 vxtime = VVIRT(.vxtime);
85 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
86 wall_jiffies = VVIRT(.wall_jiffies);
88 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
89 sys_tz = VVIRT(.sys_tz);
91 .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
92 sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
94 .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
95 xtime = VVIRT(.xtime);
97 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
98 .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
99 jiffies = VVIRT(.jiffies);
101 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) }
102 .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) }
103 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) }
105 . = VSYSCALL_VIRT_ADDR + 4096;
108 #undef VSYSCALL_PHYS_ADDR
109 #undef VSYSCALL_VIRT_ADDR
115 . = ALIGN(8192); /* init_task */
116 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
121 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
122 *(.data.page_aligned)
125 . = ALIGN(4096); /* Init code and data */
127 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
132 __initdata_begin = .;
133 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
137 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
139 __initcall_start = .;
140 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
150 __con_initcall_start = .;
151 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
152 *(.con_initcall.init)
154 __con_initcall_end = .;
157 __alt_instructions = .;
158 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
161 __alt_instructions_end = .;
162 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
163 *(.altinstr_replacement)
165 /* .exit.text is discard at runtime, not link time, to deal with references
166 from .altinstructions and .eh_frame */
167 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
168 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
170 __initramfs_start = .;
171 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
175 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
182 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
188 /* Sections to be discarded */
191 #ifndef CONFIG_DEBUG_INFO
197 .debug_info 0 : { *(.debug_info) }
198 .debug_abbrev 0 : { *(.debug_abbrev) }
199 .debug_line 0 : { *(.debug_line) }
200 .debug_frame 0 : { *(.debug_frame) }
201 .debug_str 0 : { *(.debug_str) }
202 .debug_loc 0 : { *(.debug_loc) }
203 .debug_macinfo 0 : { *(.debug_macinfo) }
204 /* SGI/MIPS DWARF 2 extensions */
205 .debug_weaknames 0 : { *(.debug_weaknames) }
206 .debug_funcnames 0 : { *(.debug_funcnames) }
207 .debug_typenames 0 : { *(.debug_typenames) }
208 .debug_varnames 0 : { *(.debug_varnames) }
211 .comment 0 : { *(.comment) }