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)
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))
64 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
65 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
67 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
68 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
71 .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) }
72 __vsyscall_0 = VSYSCALL_VIRT_ADDR;
74 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
75 .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) }
76 xtime_lock = VVIRT(.xtime_lock);
78 .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) }
79 vxtime = VVIRT(.vxtime);
81 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
82 wall_jiffies = VVIRT(.wall_jiffies);
84 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
85 sys_tz = VVIRT(.sys_tz);
87 .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) }
88 sysctl_vsyscall = VVIRT(.sysctl_vsyscall);
90 .xtime : AT(VLOAD(.xtime)) { *(.xtime) }
91 xtime = VVIRT(.xtime);
93 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
94 .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) }
95 jiffies = VVIRT(.jiffies);
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) }
101 . = VSYSCALL_VIRT_ADDR + 4096;
104 #undef VSYSCALL_PHYS_ADDR
105 #undef VSYSCALL_VIRT_ADDR
111 . = ALIGN(8192); /* init_task */
112 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
117 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
118 *(.data.page_aligned)
121 . = ALIGN(4096); /* Init code and data */
123 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
128 __initdata_begin = .;
129 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
133 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
135 __initcall_start = .;
136 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
146 __con_initcall_start = .;
147 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
148 *(.con_initcall.init)
150 __con_initcall_end = .;
153 __alt_instructions = .;
154 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
157 __alt_instructions_end = .;
158 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
159 *(.altinstr_replacement)
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) }
166 __initramfs_start = .;
167 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
171 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
178 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
184 /* Sections to be discarded */
187 #ifndef CONFIG_DEBUG_INFO
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) }
207 .comment 0 : { *(.comment) }