Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ld script to make ARM Linux kernel |
| 2 | * taken from the i386 version by Russell King |
| 3 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> |
| 4 | */ |
| 5 | |
| 6 | #include <asm-generic/vmlinux.lds.h> |
| 7 | #include <linux/config.h> |
Russell King | 4f7a181 | 2005-05-05 13:11:00 +0100 | [diff] [blame] | 8 | #include <asm/thread_info.h> |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 9 | #include <asm/memory.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
| 11 | OUTPUT_ARCH(arm) |
| 12 | ENTRY(stext) |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #ifndef __ARMEB__ |
| 15 | jiffies = jiffies_64; |
| 16 | #else |
| 17 | jiffies = jiffies_64 + 4; |
| 18 | #endif |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 19 | |
| 20 | #ifdef CONFIG_XIP_KERNEL |
| 21 | #define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) |
| 22 | #else |
| 23 | #define TEXTADDR KERNEL_RAM_ADDR |
| 24 | #endif |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | SECTIONS |
| 27 | { |
| 28 | . = TEXTADDR; |
| 29 | .init : { /* Init code and data */ |
| 30 | _stext = .; |
| 31 | _sinittext = .; |
| 32 | *(.init.text) |
| 33 | _einittext = .; |
| 34 | __proc_info_begin = .; |
Ben Dooks | 02b7dd1 | 2005-09-20 16:35:03 +0100 | [diff] [blame] | 35 | *(.proc.info.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | __proc_info_end = .; |
| 37 | __arch_info_begin = .; |
Ben Dooks | 9d0fd1e | 2005-09-20 16:45:20 +0100 | [diff] [blame] | 38 | *(.arch.info.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | __arch_info_end = .; |
| 40 | __tagtable_begin = .; |
Ben Dooks | 9506057 | 2005-09-20 16:20:49 +0100 | [diff] [blame] | 41 | *(.taglist.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | __tagtable_end = .; |
| 43 | . = ALIGN(16); |
| 44 | __setup_start = .; |
| 45 | *(.init.setup) |
| 46 | __setup_end = .; |
| 47 | __early_begin = .; |
Ben Dooks | bfe6815 | 2005-09-20 16:25:12 +0100 | [diff] [blame] | 48 | *(.early_param.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | __early_end = .; |
| 50 | __initcall_start = .; |
| 51 | *(.initcall1.init) |
| 52 | *(.initcall2.init) |
| 53 | *(.initcall3.init) |
| 54 | *(.initcall4.init) |
| 55 | *(.initcall5.init) |
| 56 | *(.initcall6.init) |
| 57 | *(.initcall7.init) |
| 58 | __initcall_end = .; |
| 59 | __con_initcall_start = .; |
| 60 | *(.con_initcall.init) |
| 61 | __con_initcall_end = .; |
| 62 | __security_initcall_start = .; |
| 63 | *(.security_initcall.init) |
| 64 | __security_initcall_end = .; |
| 65 | . = ALIGN(32); |
| 66 | __initramfs_start = .; |
| 67 | usr/built-in.o(.init.ramfs) |
| 68 | __initramfs_end = .; |
| 69 | . = ALIGN(64); |
| 70 | __per_cpu_start = .; |
| 71 | *(.data.percpu) |
| 72 | __per_cpu_end = .; |
| 73 | #ifndef CONFIG_XIP_KERNEL |
| 74 | __init_begin = _stext; |
| 75 | *(.init.data) |
| 76 | . = ALIGN(4096); |
| 77 | __init_end = .; |
| 78 | #endif |
| 79 | } |
| 80 | |
| 81 | /DISCARD/ : { /* Exit code and data */ |
| 82 | *(.exit.text) |
| 83 | *(.exit.data) |
| 84 | *(.exitcall.exit) |
| 85 | } |
| 86 | |
| 87 | .text : { /* Real text segment */ |
| 88 | _text = .; /* Text and read-only data */ |
| 89 | *(.text) |
| 90 | SCHED_TEXT |
| 91 | LOCK_TEXT |
| 92 | *(.fixup) |
| 93 | *(.gnu.warning) |
| 94 | *(.rodata) |
| 95 | *(.rodata.*) |
| 96 | *(.glue_7) |
| 97 | *(.glue_7t) |
| 98 | *(.got) /* Global offset table */ |
| 99 | } |
| 100 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | RODATA |
| 102 | |
| 103 | _etext = .; /* End of text and rodata section */ |
| 104 | |
| 105 | #ifdef CONFIG_XIP_KERNEL |
| 106 | __data_loc = ALIGN(4); /* location in binary */ |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 107 | . = KERNEL_RAM_ADDR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | #else |
Russell King | 4f7a181 | 2005-05-05 13:11:00 +0100 | [diff] [blame] | 109 | . = ALIGN(THREAD_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | __data_loc = .; |
| 111 | #endif |
| 112 | |
| 113 | .data : AT(__data_loc) { |
| 114 | __data_start = .; /* address in memory */ |
| 115 | |
| 116 | /* |
| 117 | * first, the init task union, aligned |
| 118 | * to an 8192 byte boundary. |
| 119 | */ |
| 120 | *(.init.task) |
| 121 | |
| 122 | #ifdef CONFIG_XIP_KERNEL |
| 123 | . = ALIGN(4096); |
| 124 | __init_begin = .; |
| 125 | *(.init.data) |
| 126 | . = ALIGN(4096); |
| 127 | __init_end = .; |
| 128 | #endif |
| 129 | |
| 130 | . = ALIGN(4096); |
| 131 | __nosave_begin = .; |
| 132 | *(.data.nosave) |
| 133 | . = ALIGN(4096); |
| 134 | __nosave_end = .; |
| 135 | |
| 136 | /* |
| 137 | * then the cacheline aligned data |
| 138 | */ |
| 139 | . = ALIGN(32); |
| 140 | *(.data.cacheline_aligned) |
| 141 | |
| 142 | /* |
Nicolas Pitre | 13b1f64 | 2005-10-13 22:04:37 +0100 | [diff] [blame] | 143 | * The exception fixup table (might need resorting at runtime) |
| 144 | */ |
| 145 | . = ALIGN(32); |
| 146 | __start___ex_table = .; |
| 147 | *(__ex_table) |
| 148 | __stop___ex_table = .; |
| 149 | |
| 150 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | * and the usual data section |
| 152 | */ |
| 153 | *(.data) |
| 154 | CONSTRUCTORS |
| 155 | |
| 156 | _edata = .; |
| 157 | } |
| 158 | |
| 159 | .bss : { |
| 160 | __bss_start = .; /* BSS */ |
| 161 | *(.bss) |
| 162 | *(COMMON) |
| 163 | _end = .; |
| 164 | } |
| 165 | /* Stabs debugging sections. */ |
| 166 | .stab 0 : { *(.stab) } |
| 167 | .stabstr 0 : { *(.stabstr) } |
| 168 | .stab.excl 0 : { *(.stab.excl) } |
| 169 | .stab.exclstr 0 : { *(.stab.exclstr) } |
| 170 | .stab.index 0 : { *(.stab.index) } |
| 171 | .stab.indexstr 0 : { *(.stab.indexstr) } |
| 172 | .comment 0 : { *(.comment) } |
| 173 | } |
| 174 | |
Russell King | 728f5c0 | 2005-11-17 16:43:14 +0000 | [diff] [blame^] | 175 | /* |
| 176 | * These must never be empty |
| 177 | * If you have to comment these two assert statements out, your |
| 178 | * binutils is too old (for other reasons as well) |
| 179 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") |
| 181 | ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") |