2 * arch/ubicom32/kernel/vmlinux.lds.S
3 * vmlinux primary linker script
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
28 #include <asm-generic/vmlinux.lds.h>
29 #include <asm/ocm_size.h>
30 #include <asm/memory_map.h>
31 #include <asm/thread_info.h>
32 #include <linux/threads.h>
35 * Sanity checks to prevent errors later on that are much harder to understand
37 #if !defined APP_OCM_CODE_SIZE
38 #error APP_OCM_CODE_SIZE has not been defined in ocm_size.h
41 #if !defined APP_OCM_DATA_SIZE
42 #error APP_OCM_DATA_SIZE has not been defined in ocm_size.h
46 * The `free' ocm area that ultra does not use.
48 #if APP_OCM_CODE_SIZE || APP_OCM_DATA_SIZE
49 #define OCM_FREE_START (OCMSTART + APP_OCM_CODE_SIZE)
50 #define OCM_FREE_LENGTH (OCMSIZE - APP_OCM_CODE_SIZE - APP_OCM_DATA_SIZE)
52 #define OCM_FREE_START OCMEND
53 #define OCM_FREE_LENGTH 0
57 * If you want to limit OCM use for text/data or completely disable it
58 * you can change these values.
60 #define OCM_TEXT_LENGTH OCM_FREE_LENGTH
61 #define OCM_DATA_LENGTH OCM_FREE_LENGTH
63 #define RAM_START KERNELSTART
64 #define RAM_LENGTH ((SDRAMSTART + CONFIG_MIN_RAMSIZE) - RAM_START)
74 #include <asm-generic/vmlinux.lds.h>
80 ram : ORIGIN = RAM_START, LENGTH = RAM_LENGTH
81 syscall : ORIGIN = OS_SYSCALL_BEGIN, LENGTH = (OS_SYSCALL_END - OS_SYSCALL_BEGIN)
82 ocm : ORIGIN = OCM_FREE_START, LENGTH = OCM_FREE_LENGTH
85 jiffies = jiffies_64 + 4;
88 * Fixed locations required by gdb coredumps.
90 * Note that the names are what gdb is expecting so renaming will break
93 __ocm_begin = OCMSTART;
94 __ocm_limit = __ocm_begin + OCMSIZE;
95 __sdram_begin = SDRAMSTART;
96 __sdram_limit = __sdram_begin + CONFIG_MIN_RAMSIZE;
97 __filemedia_begin_addr = FLASHSTART;
98 __filemedia_end_addr = __filemedia_begin_addr + 0x00800000;
101 * For internal diagnostics
103 __os_syscall_begin = OS_SYSCALL_BEGIN;
104 __os_syscall_end = OS_SYSCALL_END;
111 *(.old_syscall_entry.text)
112 __fixed_text_end = .;
114 . = _begin + SIZEOF(.fixed_text) ;
117 * System call text in lower ocm (fixed location, can never change)
119 __syscall_text_load_begin = .;
120 __syscall_text_run_begin = OS_SYSCALL_BEGIN;
122 .syscall_text __syscall_text_run_begin : AT(__syscall_text_load_begin) {
123 *(.syscall_entry.text) /* Must be at OS_SYSCALL_BEGIN 0x3ffc0040 */
124 *(.kernel_unprotected)
126 __syscall_text_run_end = .;
127 } > syscall /* .syscall_text */
128 . = __syscall_text_load_begin + __syscall_text_run_end - __syscall_text_run_begin ;
129 __ocm_text_load_begin = .;
130 __ocm_text_run_begin = OCM_FREE_START ;
131 .ocm_text __ocm_text_run_begin : AT(__ocm_text_load_begin) {
136 #include <asm/ocm_text.lds.inc>
139 __ocm_text_run_end = .;
140 __data_begin = ALIGN(OCM_SECTOR_SIZE);
141 } > ocm /* .ocm_text */
143 .ocm_module_text __ocm_text_run_end (NOLOAD) : AT(__ocm_text_run_end) {
144 __ocm_inst_heap_begin = .;
145 /* Reserve the min requested */
146 . += (CONFIG_OCM_MODULES_RESERVATION) * 1024;
147 #ifdef CONFIG_OCM_MODULES_MAY_CONSUME_REMAINING_CODESPACE
148 /* Round up to OCM sector size (we cannot use it for data) */
149 . = ALIGN(OCM_SECTOR_SIZE);
151 __ocm_inst_heap_end = .;
152 /* update __data_begin */
153 __data_begin = ALIGN(OCM_SECTOR_SIZE);
154 } > ocm /* .ocm_module_text */
156 . = __ocm_text_load_begin + __ocm_text_run_end - __ocm_text_run_begin ;
157 __ocm_text_load_end = .;
159 __ocm_data_load_begin = .;
160 __ocm_data_run_begin = __data_begin ;
162 .ocm_data __ocm_data_run_begin : AT(__ocm_data_load_begin) {
163 #if defined(CONFIG_IRQSTACKS_USEOCM)
164 percpu_irq_stacks = .;
165 . += NR_CPUS * THREAD_SIZE;
169 __ocm_data_run_end = .;
171 . = __ocm_data_load_begin + __ocm_data_run_end - __ocm_data_run_begin ;
173 __ocm_data_run_end = __ocm_data_run_begin;
175 __ocm_data_load_end = .;
177 __ocm_free_begin = __ocm_data_run_end;
178 __ocm_free_end = OCM_FREE_START + OCM_FREE_LENGTH;
180 .text __ocm_data_load_end : AT(__ocm_data_load_end) {
188 *(.text.__libgcc_udivmodsi)
189 *(.text.__libgcc_divmodsi)
190 *(.text.__libgcc_muldi3)
191 *(.text.__libgcc_udivmoddi)
192 *(.text.__libgcc_divmoddi)
194 #if OCM_TEXT_LENGTH == 0
199 . = ALIGN(16); /* Exception table */
200 __start___ex_table = .;
202 __stop___ex_table = .;
204 *(.rodata) *(.rodata.*)
205 *(__vermagic) /* Kernel version magic */
209 *(__tracepoints_strings)
212 __start_pci_fixups_early = . ;
214 __end_pci_fixups_early = . ;
215 __start_pci_fixups_header = . ;
217 __end_pci_fixups_header = . ;
218 __start_pci_fixups_final = . ;
220 __end_pci_fixups_final = . ;
221 __start_pci_fixups_enable = . ;
223 __end_pci_fixups_enable = . ;
224 __start_pci_fixups_resume = . ;
226 __end_pci_fixups_resume = . ;
227 __start_pci_fixups_resume_early = . ;
228 *(.pci_fixup_resume_early)
229 __end_pci_fixups_resume_early = . ;
230 __start_pci_fixups_suspend = . ;
231 *(.pci_fixup_suspend)
232 __end_pci_fixups_suspend = . ;
234 __start_builtin_fw = . ;
236 __end_builtin_fw = . ;
239 /* Kernel symbol table: Normal symbols */
241 __start___ksymtab = .;
243 __stop___ksymtab = .;
245 /* Kernel symbol table: GPL-only symbols */
246 __start___ksymtab_gpl = .;
248 __stop___ksymtab_gpl = .;
250 /* Kernel symbol table: Normal unused symbols */
251 __start___ksymtab_unused = .;
253 __stop___ksymtab_unused = .;
255 /* Kernel symbol table: GPL-only unused symbols */
256 __start___ksymtab_unused_gpl = .;
257 *(__ksymtab_unused_gpl)
258 __stop___ksymtab_unused_gpl = .;
260 /* Kernel symbol table: GPL-future symbols */
261 __start___ksymtab_gpl_future = .;
262 *(__ksymtab_gpl_future)
263 __stop___ksymtab_gpl_future = .;
265 /* Kernel symbol table: Normal symbols */
266 __start___kcrctab = .;
268 __stop___kcrctab = .;
270 /* Kernel symbol table: GPL-only symbols */
271 __start___kcrctab_gpl = .;
273 __stop___kcrctab_gpl = .;
275 /* Kernel symbol table: GPL-future symbols */
276 __start___kcrctab_gpl_future = .;
277 *(__kcrctab_gpl_future)
278 __stop___kcrctab_gpl_future = .;
280 /* Kernel symbol table: strings */
283 /* Built-in module parameters */
297 #if OCM_DATA_LENGTH == 0
301 _data_protection_end = .;
319 __initcall_start = .;
322 __con_initcall_start = .;
323 *(.con_initcall.init)
324 __con_initcall_end = .;
325 ___security_initcall_start = .;
326 *(.security_initcall.init)
327 ___security_initcall_end = .;
328 #ifdef CONFIG_BLK_DEV_INITRD
330 __initramfs_start = .;
337 *(.data.percpu.shared_aligned)
346 PROVIDE (___eh_frame_begin = .);
349 PROVIDE (___eh_frame_end = .);