Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 2 | * ld script to make SH64 Linux kernel |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2000, 2001 Paolo Alberelli |
| 5 | * |
| 6 | * benedict.gaster@superh.com: 2nd May 2002 |
| 7 | * Add definition of empty_zero_page to be the first page of kernel image. |
| 8 | * |
| 9 | * benedict.gaster@superh.com: 3rd May 2002 |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 10 | * Added support for ramdisk, removing statically linked romfs at the |
| 11 | * same time. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | * |
| 13 | * lethal@linux-sh.org: 9th May 2003 |
| 14 | * Kill off GLOBAL_NAME() usage and other CDC-isms. |
| 15 | * |
| 16 | * lethal@linux-sh.org: 19th May 2003 |
| 17 | * Remove support for ancient toolchains. |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 18 | * |
| 19 | * This file is subject to the terms and conditions of the GNU General Public |
| 20 | * License. See the file "COPYING" in the main directory of this archive |
| 21 | * for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/page.h> |
| 24 | #include <asm/cache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <asm/thread_info.h> |
| 26 | |
Paul Mundt | 36763b2 | 2007-11-21 15:34:33 +0900 | [diff] [blame] | 27 | #define LOAD_OFFSET CONFIG_PAGE_OFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <asm-generic/vmlinux.lds.h> |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | OUTPUT_ARCH(sh:sh5) |
| 31 | |
| 32 | #define C_PHYS(x) AT (ADDR(x) - LOAD_OFFSET) |
| 33 | |
| 34 | ENTRY(__start) |
| 35 | SECTIONS |
| 36 | { |
Paul Mundt | 36763b2 | 2007-11-21 15:34:33 +0900 | [diff] [blame] | 37 | . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + PAGE_SIZE; |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 38 | _text = .; /* Text and read-only data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 40 | .empty_zero_page : C_PHYS(.empty_zero_page) { |
| 41 | *(.empty_zero_page) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | } = 0 |
| 43 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 44 | .text : C_PHYS(.text) { |
| 45 | *(.text.head) |
| 46 | TEXT_TEXT |
| 47 | *(.text64) |
| 48 | *(.text..SHmedia32) |
| 49 | SCHED_TEXT |
| 50 | LOCK_TEXT |
| 51 | KPROBES_TEXT |
| 52 | *(.fixup) |
| 53 | *(.gnu.warning) |
Paul Mundt | f99cb7a4 | 2008-02-13 20:28:12 +0900 | [diff] [blame] | 54 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | } = 0x6ff0fff0 |
| 56 | #else |
| 57 | } = 0xf0fff06f |
| 58 | #endif |
| 59 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 60 | /* We likely want __ex_table to be Cache Line aligned */ |
| 61 | . = ALIGN(L1_CACHE_BYTES); /* Exception table */ |
| 62 | __start___ex_table = .; |
| 63 | __ex_table : C_PHYS(__ex_table) { *(__ex_table) } |
| 64 | __stop___ex_table = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 66 | _etext = .; /* End of text section */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 68 | NOTES |
| 69 | RO_DATA(PAGE_SIZE) |
Paul Mundt | 3f7a0ce | 2007-10-09 15:53:16 +0900 | [diff] [blame] | 70 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 71 | . = ALIGN(THREAD_SIZE); |
| 72 | .data : C_PHYS(.data) { /* Data */ |
| 73 | *(.data.init_task) |
Paul Mundt | 3f7a0ce | 2007-10-09 15:53:16 +0900 | [diff] [blame] | 74 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 75 | . = ALIGN(L1_CACHE_BYTES); |
| 76 | *(.data.cacheline_aligned) |
| 77 | |
| 78 | . = ALIGN(L1_CACHE_BYTES); |
| 79 | *(.data.read_mostly) |
| 80 | |
| 81 | . = ALIGN(PAGE_SIZE); |
| 82 | *(.data.page_aligned) |
| 83 | |
| 84 | __nosave_begin = .; |
| 85 | *(.data.nosave) |
| 86 | . = ALIGN(PAGE_SIZE); |
| 87 | __nosave_end = .; |
| 88 | |
| 89 | DATA_DATA |
| 90 | CONSTRUCTORS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 93 | _edata = .; /* End of data section */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 95 | . = ALIGN(PAGE_SIZE); /* Init code and data */ |
| 96 | __init_begin = .; |
| 97 | _sinittext = .; |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 98 | .init.text : C_PHYS(.init.text) { INIT_TEXT } |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 99 | _einittext = .; |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 100 | .init.data : C_PHYS(.init.data) { INIT_DATA } |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 101 | . = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */ |
| 102 | __setup_start = .; |
| 103 | .init.setup : C_PHYS(.init.setup) { *(.init.setup) } |
| 104 | __setup_end = .; |
| 105 | __initcall_start = .; |
| 106 | .initcall.init : C_PHYS(.initcall.init) { |
| 107 | INITCALLS |
| 108 | } |
| 109 | __initcall_end = .; |
| 110 | __con_initcall_start = .; |
| 111 | .con_initcall.init : C_PHYS(.con_initcall.init) { |
| 112 | *(.con_initcall.init) |
| 113 | } |
| 114 | __con_initcall_end = .; |
Paul Mundt | 3f7a0ce | 2007-10-09 15:53:16 +0900 | [diff] [blame] | 115 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 116 | SECURITY_INIT |
Jean-Paul Saman | 67d3822 | 2007-02-10 01:44:44 -0800 | [diff] [blame] | 117 | |
| 118 | #ifdef CONFIG_BLK_DEV_INITRD |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 119 | . = ALIGN(PAGE_SIZE); |
| 120 | __initramfs_start = .; |
| 121 | .init.ramfs : C_PHYS(.init.ramfs) { *(.init.ramfs) } |
| 122 | __initramfs_end = .; |
Jean-Paul Saman | 67d3822 | 2007-02-10 01:44:44 -0800 | [diff] [blame] | 123 | #endif |
| 124 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 125 | . = ALIGN(8); |
| 126 | __machvec_start = .; |
| 127 | .machvec.init : C_PHYS(.machvec.init) { *(.machvec.init) } |
| 128 | __machvec_end = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 130 | PERCPU(PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 132 | /* |
| 133 | * .exit.text is discarded at runtime, not link time, to deal with |
| 134 | * references from __bug_table |
| 135 | */ |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 136 | .exit.text : C_PHYS(.exit.text) { EXIT_TEXT } |
| 137 | .exit.data : C_PHYS(.exit.data) { EXIT_DATA } |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 138 | |
| 139 | . = ALIGN(PAGE_SIZE); |
| 140 | .bss : C_PHYS(.bss) { |
| 141 | __init_end = .; |
| 142 | __bss_start = .; /* BSS */ |
| 143 | *(.bss.page_aligned) |
| 144 | *(.bss) |
| 145 | *(COMMON) |
| 146 | . = ALIGN(4); |
| 147 | _ebss = .; /* uClinux MTD sucks */ |
| 148 | _end = . ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Paul Mundt | 6694e82 | 2007-11-20 15:35:42 +0900 | [diff] [blame] | 151 | /* |
| 152 | * When something in the kernel is NOT compiled as a module, the |
| 153 | * module cleanup code and data are put into these segments. Both |
| 154 | * can then be thrown away, as cleanup code is never called unless |
| 155 | * it's a module. |
| 156 | */ |
| 157 | /DISCARD/ : { |
| 158 | *(.exitcall.exit) |
| 159 | } |
| 160 | |
| 161 | STABS_DEBUG |
| 162 | DWARF_DEBUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | } |