blob: d1e177009a4140ab0e86a47040fee7256b9a1e97 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Paul Mundt6694e822007-11-20 15:35:42 +09002 * ld script to make SH64 Linux kernel
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
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 Mundt6694e822007-11-20 15:35:42 +090010 * Added support for ramdisk, removing statically linked romfs at the
11 * same time.
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 *
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 Mundt6694e822007-11-20 15:35:42 +090018 *
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 Torvalds1da177e2005-04-16 15:20:36 -070022 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/page.h>
24#include <asm/cache.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/thread_info.h>
26
Paul Mundt36763b22007-11-21 15:34:33 +090027#define LOAD_OFFSET CONFIG_PAGE_OFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm-generic/vmlinux.lds.h>
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030OUTPUT_ARCH(sh:sh5)
31
32#define C_PHYS(x) AT (ADDR(x) - LOAD_OFFSET)
33
34ENTRY(__start)
35SECTIONS
36{
Paul Mundt36763b22007-11-21 15:34:33 +090037 . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + PAGE_SIZE;
Paul Mundt6694e822007-11-20 15:35:42 +090038 _text = .; /* Text and read-only data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Paul Mundt6694e822007-11-20 15:35:42 +090040 .empty_zero_page : C_PHYS(.empty_zero_page) {
41 *(.empty_zero_page)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 } = 0
43
Paul Mundt6694e822007-11-20 15:35:42 +090044 .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 Mundtf99cb7a2008-02-13 20:28:12 +090054#ifdef CONFIG_CPU_LITTLE_ENDIAN
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 } = 0x6ff0fff0
56#else
57 } = 0xf0fff06f
58#endif
59
Paul Mundt6694e822007-11-20 15:35:42 +090060 /* 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 Torvalds1da177e2005-04-16 15:20:36 -070065
Paul Mundt6694e822007-11-20 15:35:42 +090066 _etext = .; /* End of text section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Paul Mundt6694e822007-11-20 15:35:42 +090068 BUG_TABLE
69 NOTES
70 RO_DATA(PAGE_SIZE)
Paul Mundt3f7a0ce2007-10-09 15:53:16 +090071
Paul Mundt6694e822007-11-20 15:35:42 +090072 . = ALIGN(THREAD_SIZE);
73 .data : C_PHYS(.data) { /* Data */
74 *(.data.init_task)
Paul Mundt3f7a0ce2007-10-09 15:53:16 +090075
Paul Mundt6694e822007-11-20 15:35:42 +090076 . = ALIGN(L1_CACHE_BYTES);
77 *(.data.cacheline_aligned)
78
79 . = ALIGN(L1_CACHE_BYTES);
80 *(.data.read_mostly)
81
82 . = ALIGN(PAGE_SIZE);
83 *(.data.page_aligned)
84
85 __nosave_begin = .;
86 *(.data.nosave)
87 . = ALIGN(PAGE_SIZE);
88 __nosave_end = .;
89
90 DATA_DATA
91 CONSTRUCTORS
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 }
93
Paul Mundt6694e822007-11-20 15:35:42 +090094 _edata = .; /* End of data section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
Paul Mundt6694e822007-11-20 15:35:42 +090096 . = ALIGN(PAGE_SIZE); /* Init code and data */
97 __init_begin = .;
98 _sinittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010099 .init.text : C_PHYS(.init.text) { INIT_TEXT }
Paul Mundt6694e822007-11-20 15:35:42 +0900100 _einittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100101 .init.data : C_PHYS(.init.data) { INIT_DATA }
Paul Mundt6694e822007-11-20 15:35:42 +0900102 . = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */
103 __setup_start = .;
104 .init.setup : C_PHYS(.init.setup) { *(.init.setup) }
105 __setup_end = .;
106 __initcall_start = .;
107 .initcall.init : C_PHYS(.initcall.init) {
108 INITCALLS
109 }
110 __initcall_end = .;
111 __con_initcall_start = .;
112 .con_initcall.init : C_PHYS(.con_initcall.init) {
113 *(.con_initcall.init)
114 }
115 __con_initcall_end = .;
Paul Mundt3f7a0ce2007-10-09 15:53:16 +0900116
Paul Mundt6694e822007-11-20 15:35:42 +0900117 SECURITY_INIT
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800118
119#ifdef CONFIG_BLK_DEV_INITRD
Paul Mundt6694e822007-11-20 15:35:42 +0900120 . = ALIGN(PAGE_SIZE);
121 __initramfs_start = .;
122 .init.ramfs : C_PHYS(.init.ramfs) { *(.init.ramfs) }
123 __initramfs_end = .;
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800124#endif
125
Paul Mundt6694e822007-11-20 15:35:42 +0900126 . = ALIGN(8);
127 __machvec_start = .;
128 .machvec.init : C_PHYS(.machvec.init) { *(.machvec.init) }
129 __machvec_end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
Paul Mundt6694e822007-11-20 15:35:42 +0900131 PERCPU(PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
Paul Mundt6694e822007-11-20 15:35:42 +0900133 /*
134 * .exit.text is discarded at runtime, not link time, to deal with
135 * references from __bug_table
136 */
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100137 .exit.text : C_PHYS(.exit.text) { EXIT_TEXT }
138 .exit.data : C_PHYS(.exit.data) { EXIT_DATA }
Paul Mundt6694e822007-11-20 15:35:42 +0900139
140 . = ALIGN(PAGE_SIZE);
141 .bss : C_PHYS(.bss) {
142 __init_end = .;
143 __bss_start = .; /* BSS */
144 *(.bss.page_aligned)
145 *(.bss)
146 *(COMMON)
147 . = ALIGN(4);
148 _ebss = .; /* uClinux MTD sucks */
149 _end = . ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 }
151
Paul Mundt6694e822007-11-20 15:35:42 +0900152 /*
153 * When something in the kernel is NOT compiled as a module, the
154 * module cleanup code and data are put into these segments. Both
155 * can then be thrown away, as cleanup code is never called unless
156 * it's a module.
157 */
158 /DISCARD/ : {
159 *(.exitcall.exit)
160 }
161
162 STABS_DEBUG
163 DWARF_DEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164}