Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ld script to make x86-64 Linux kernel |
| 2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; |
| 3 | */ |
| 4 | |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 5 | #define LOAD_OFFSET __START_KERNEL_map |
| 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <asm-generic/vmlinux.lds.h> |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 8 | #include <asm/page.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | { |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 17 | . = __START_KERNEL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | phys_startup_64 = startup_64 - LOAD_OFFSET; |
| 19 | _text = .; /* Text and read-only data */ |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 20 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | *(.text) |
| 22 | SCHED_TEXT |
| 23 | LOCK_TEXT |
| 24 | *(.fixup) |
| 25 | *(.gnu.warning) |
| 26 | } = 0x9090 |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 27 | /* out-of-line lock text */ |
| 28 | .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
| 30 | _etext = .; /* End of text section */ |
| 31 | |
| 32 | . = ALIGN(16); /* Exception table */ |
| 33 | __start___ex_table = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 34 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | __stop___ex_table = .; |
| 36 | |
| 37 | RODATA |
| 38 | |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 39 | /* Data */ |
| 40 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | *(.data) |
| 42 | CONSTRUCTORS |
| 43 | } |
| 44 | |
| 45 | _edata = .; /* End of data section */ |
| 46 | |
| 47 | __bss_start = .; /* BSS */ |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 48 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | *(.bss.page_aligned) |
| 50 | *(.bss) |
| 51 | } |
| 52 | __bss_end = .; |
| 53 | |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 54 | . = ALIGN(PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 56 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
| 57 | *(.data.cacheline_aligned) |
| 58 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 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)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | . = ALIGN(8192); /* init_task */ |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 112 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
| 113 | *(.data.init_task) |
| 114 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | . = ALIGN(4096); |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 117 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
| 118 | *(.data.page_aligned) |
| 119 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
| 121 | . = ALIGN(4096); /* Init code and data */ |
| 122 | __init_begin = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 123 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | _sinittext = .; |
| 125 | *(.init.text) |
| 126 | _einittext = .; |
| 127 | } |
| 128 | __initdata_begin = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 129 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | __initdata_end = .; |
| 131 | . = ALIGN(16); |
| 132 | __setup_start = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 133 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | __setup_end = .; |
| 135 | __initcall_start = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 136 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 147 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
| 148 | *(.con_initcall.init) |
| 149 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | __con_initcall_end = .; |
| 151 | SECURITY_INIT |
| 152 | . = ALIGN(8); |
| 153 | __alt_instructions = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 154 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
| 155 | *(.altinstructions) |
| 156 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | __alt_instructions_end = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 158 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
| 159 | *(.altinstr_replacement) |
| 160 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | /* .exit.text is discard at runtime, not link time, to deal with references |
| 162 | from .altinstructions and .eh_frame */ |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 163 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
| 164 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | . = ALIGN(4096); |
| 166 | __initramfs_start = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 167 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | __initramfs_end = .; |
| 169 | . = ALIGN(32); |
| 170 | __per_cpu_start = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 171 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | __per_cpu_end = .; |
| 173 | . = ALIGN(4096); |
| 174 | __init_end = .; |
| 175 | |
| 176 | . = ALIGN(4096); |
| 177 | __nosave_begin = .; |
Eric W. Biederman | 5ded01e | 2005-06-25 14:57:48 -0700 | [diff] [blame] | 178 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | } |