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 | |
| 5 | #include <asm-generic/vmlinux.lds.h> |
| 6 | #include <linux/config.h> |
| 7 | |
| 8 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") |
| 9 | OUTPUT_ARCH(i386:x86-64) |
| 10 | ENTRY(phys_startup_64) |
| 11 | jiffies_64 = jiffies; |
| 12 | SECTIONS |
| 13 | { |
| 14 | . = 0xffffffff80100000; |
| 15 | phys_startup_64 = startup_64 - LOAD_OFFSET; |
| 16 | _text = .; /* Text and read-only data */ |
| 17 | .text : { |
| 18 | *(.text) |
| 19 | SCHED_TEXT |
| 20 | LOCK_TEXT |
| 21 | *(.fixup) |
| 22 | *(.gnu.warning) |
| 23 | } = 0x9090 |
| 24 | .text.lock : { *(.text.lock) } /* out-of-line lock text */ |
| 25 | |
| 26 | _etext = .; /* End of text section */ |
| 27 | |
| 28 | . = ALIGN(16); /* Exception table */ |
| 29 | __start___ex_table = .; |
| 30 | __ex_table : { *(__ex_table) } |
| 31 | __stop___ex_table = .; |
| 32 | |
| 33 | RODATA |
| 34 | |
| 35 | .data : { /* Data */ |
| 36 | *(.data) |
| 37 | CONSTRUCTORS |
| 38 | } |
| 39 | |
| 40 | _edata = .; /* End of data section */ |
| 41 | |
| 42 | __bss_start = .; /* BSS */ |
| 43 | .bss : { |
| 44 | *(.bss.page_aligned) |
| 45 | *(.bss) |
| 46 | } |
| 47 | __bss_end = .; |
| 48 | |
| 49 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
| 50 | .data.cacheline_aligned : { *(.data.cacheline_aligned) } |
| 51 | |
| 52 | #define AFTER(x) BINALIGN(LOADADDR(x) + SIZEOF(x), 16) |
| 53 | #define BINALIGN(x,y) (((x) + (y) - 1) & ~((y) - 1)) |
| 54 | #define CACHE_ALIGN(x) BINALIGN(x, CONFIG_X86_L1_CACHE_BYTES) |
| 55 | |
| 56 | .vsyscall_0 -10*1024*1024: AT ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095)) { *(.vsyscall_0) } |
| 57 | __vsyscall_0 = LOADADDR(.vsyscall_0); |
| 58 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
| 59 | .xtime_lock : AT CACHE_ALIGN(AFTER(.vsyscall_0)) { *(.xtime_lock) } |
| 60 | xtime_lock = LOADADDR(.xtime_lock); |
| 61 | .vxtime : AT AFTER(.xtime_lock) { *(.vxtime) } |
| 62 | vxtime = LOADADDR(.vxtime); |
| 63 | .wall_jiffies : AT AFTER(.vxtime) { *(.wall_jiffies) } |
| 64 | wall_jiffies = LOADADDR(.wall_jiffies); |
| 65 | .sys_tz : AT AFTER(.wall_jiffies) { *(.sys_tz) } |
| 66 | sys_tz = LOADADDR(.sys_tz); |
| 67 | .sysctl_vsyscall : AT AFTER(.sys_tz) { *(.sysctl_vsyscall) } |
| 68 | sysctl_vsyscall = LOADADDR(.sysctl_vsyscall); |
| 69 | .xtime : AT AFTER(.sysctl_vsyscall) { *(.xtime) } |
| 70 | xtime = LOADADDR(.xtime); |
| 71 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); |
| 72 | .jiffies : AT CACHE_ALIGN(AFTER(.xtime)) { *(.jiffies) } |
| 73 | jiffies = LOADADDR(.jiffies); |
| 74 | .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) } |
| 75 | . = LOADADDR(.vsyscall_0) + 4096; |
| 76 | |
| 77 | . = ALIGN(8192); /* init_task */ |
| 78 | .data.init_task : { *(.data.init_task) } |
| 79 | |
| 80 | . = ALIGN(4096); |
| 81 | .data.page_aligned : { *(.data.page_aligned) } |
| 82 | |
| 83 | . = ALIGN(4096); /* Init code and data */ |
| 84 | __init_begin = .; |
| 85 | .init.text : { |
| 86 | _sinittext = .; |
| 87 | *(.init.text) |
| 88 | _einittext = .; |
| 89 | } |
| 90 | __initdata_begin = .; |
| 91 | .init.data : { *(.init.data) } |
| 92 | __initdata_end = .; |
| 93 | . = ALIGN(16); |
| 94 | __setup_start = .; |
| 95 | .init.setup : { *(.init.setup) } |
| 96 | __setup_end = .; |
| 97 | __initcall_start = .; |
| 98 | .initcall.init : { |
| 99 | *(.initcall1.init) |
| 100 | *(.initcall2.init) |
| 101 | *(.initcall3.init) |
| 102 | *(.initcall4.init) |
| 103 | *(.initcall5.init) |
| 104 | *(.initcall6.init) |
| 105 | *(.initcall7.init) |
| 106 | } |
| 107 | __initcall_end = .; |
| 108 | __con_initcall_start = .; |
| 109 | .con_initcall.init : { *(.con_initcall.init) } |
| 110 | __con_initcall_end = .; |
| 111 | SECURITY_INIT |
| 112 | . = ALIGN(8); |
| 113 | __alt_instructions = .; |
| 114 | .altinstructions : { *(.altinstructions) } |
| 115 | __alt_instructions_end = .; |
| 116 | .altinstr_replacement : { *(.altinstr_replacement) } |
| 117 | /* .exit.text is discard at runtime, not link time, to deal with references |
| 118 | from .altinstructions and .eh_frame */ |
| 119 | .exit.text : { *(.exit.text) } |
| 120 | .exit.data : { *(.exit.data) } |
| 121 | . = ALIGN(4096); |
| 122 | __initramfs_start = .; |
| 123 | .init.ramfs : { *(.init.ramfs) } |
| 124 | __initramfs_end = .; |
| 125 | . = ALIGN(32); |
| 126 | __per_cpu_start = .; |
| 127 | .data.percpu : { *(.data.percpu) } |
| 128 | __per_cpu_end = .; |
| 129 | . = ALIGN(4096); |
| 130 | __init_end = .; |
| 131 | |
| 132 | . = ALIGN(4096); |
| 133 | __nosave_begin = .; |
| 134 | .data_nosave : { *(.data.nosave) } |
| 135 | . = ALIGN(4096); |
| 136 | __nosave_end = .; |
| 137 | |
| 138 | _end = . ; |
| 139 | |
| 140 | /* Sections to be discarded */ |
| 141 | /DISCARD/ : { |
| 142 | *(.exitcall.exit) |
| 143 | #ifndef CONFIG_DEBUG_INFO |
| 144 | *(.eh_frame) |
| 145 | #endif |
| 146 | } |
| 147 | |
| 148 | /* DWARF 2 */ |
| 149 | .debug_info 0 : { *(.debug_info) } |
| 150 | .debug_abbrev 0 : { *(.debug_abbrev) } |
| 151 | .debug_line 0 : { *(.debug_line) } |
| 152 | .debug_frame 0 : { *(.debug_frame) } |
| 153 | .debug_str 0 : { *(.debug_str) } |
| 154 | .debug_loc 0 : { *(.debug_loc) } |
| 155 | .debug_macinfo 0 : { *(.debug_macinfo) } |
| 156 | /* SGI/MIPS DWARF 2 extensions */ |
| 157 | .debug_weaknames 0 : { *(.debug_weaknames) } |
| 158 | .debug_funcnames 0 : { *(.debug_funcnames) } |
| 159 | .debug_typenames 0 : { *(.debug_typenames) } |
| 160 | .debug_varnames 0 : { *(.debug_varnames) } |
| 161 | |
| 162 | |
| 163 | .comment 0 : { *(.comment) } |
| 164 | } |