blob: 4122678529c0ace39455107651e100f919d5b7cf [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Robin Getz96f10502009-09-24 14:11:24 +00004 * Licensed under the GPL-2 or later
Bryan Wu1394f032007-05-06 14:50:22 -07005 */
6
Bryan Wu1394f032007-05-06 14:50:22 -07007#include <asm-generic/vmlinux.lds.h>
8#include <asm/mem_map.h>
Mike Frysinger520473b2007-07-12 12:20:20 +08009#include <asm/page.h>
Bernd Schmidt0fa63ad2007-07-25 10:19:59 +080010#include <asm/thread_info.h>
Bryan Wu1394f032007-05-06 14:50:22 -070011
Bryan Wu1394f032007-05-06 14:50:22 -070012OUTPUT_FORMAT("elf32-bfin")
13ENTRY(__start)
14_jiffies = _jiffies_64;
15
Bryan Wu1394f032007-05-06 14:50:22 -070016SECTIONS
17{
Barry Songd86bfb12010-01-07 04:11:17 +000018#ifdef CONFIG_RAMKERNEL
Bryan Wu1394f032007-05-06 14:50:22 -070019 . = CONFIG_BOOT_LOAD;
Barry Songd86bfb12010-01-07 04:11:17 +000020#else
21 . = CONFIG_ROM_BASE;
22#endif
23
Mike Frysingerb7627ac2008-02-02 15:53:17 +080024 /* Neither the text, ro_data or bss section need to be aligned
25 * So pack them back to back
26 */
Bryan Wu1394f032007-05-06 14:50:22 -070027 .text :
28 {
Mike Frysingerde6a9522007-06-11 17:27:05 +080029 __text = .;
30 _text = .;
31 __stext = .;
Sam Ravnborg76647092007-05-13 00:31:33 +020032 TEXT_TEXT
Robin Getzb8d0c772009-03-31 13:40:52 +000033#ifndef CONFIG_SCHEDULE_L1
Bryan Wu1394f032007-05-06 14:50:22 -070034 SCHED_TEXT
Robin Getzb8d0c772009-03-31 13:40:52 +000035#endif
Mike Frysingerde6a9522007-06-11 17:27:05 +080036 LOCK_TEXT
Mike Frysinger1ee76d72009-06-10 04:45:29 -040037 IRQENTRY_TEXT
Mike Frysinger27d875f2007-08-27 16:08:53 +080038 KPROBES_TEXT
Barry Songd86bfb12010-01-07 04:11:17 +000039#ifdef CONFIG_ROMKERNEL
40 __sinittext = .;
41 INIT_TEXT
42 __einittext = .;
43 EXIT_TEXT
44#endif
Mike Frysinger27d875f2007-08-27 16:08:53 +080045 *(.text.*)
Bryan Wu1394f032007-05-06 14:50:22 -070046 *(.fixup)
Bryan Wu1394f032007-05-06 14:50:22 -070047
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080048#if !L1_CODE_LENGTH
49 *(.l1.text)
50#endif
Bryan Wu1394f032007-05-06 14:50:22 -070051 __etext = .;
Mike Frysingerde6a9522007-06-11 17:27:05 +080052 }
Bryan Wu1394f032007-05-06 14:50:22 -070053
Mike Frysingerd49e8e72010-05-24 23:15:31 +000054 EXCEPTION_TABLE(4)
Bernd Schmidt6f985292009-01-07 23:14:39 +080055 NOTES
56
Mike Frysingerb7627ac2008-02-02 15:53:17 +080057 /* Just in case the first read only is a 32-bit access */
58 RO_DATA(4)
Barry Songd86bfb12010-01-07 04:11:17 +000059 __rodata_end = .;
Mike Frysingerb7627ac2008-02-02 15:53:17 +080060
Barry Songd86bfb12010-01-07 04:11:17 +000061#ifdef CONFIG_ROMKERNEL
62 . = CONFIG_BOOT_LOAD;
63 .bss : AT(__rodata_end)
64#else
Mike Frysingerb7627ac2008-02-02 15:53:17 +080065 .bss :
Barry Songd86bfb12010-01-07 04:11:17 +000066#endif
Mike Frysingerb7627ac2008-02-02 15:53:17 +080067 {
68 . = ALIGN(4);
69 ___bss_start = .;
70 *(.bss .bss.*)
71 *(COMMON)
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080072#if !L1_DATA_A_LENGTH
73 *(.l1.bss)
74#endif
75#if !L1_DATA_B_LENGTH
76 *(.l1.bss.B)
77#endif
Mike Frysinger13752042008-08-06 17:10:57 +080078 . = ALIGN(4);
Mike Frysingerb7627ac2008-02-02 15:53:17 +080079 ___bss_stop = .;
80 }
Mike Frysingerde6a9522007-06-11 17:27:05 +080081
Barry Songd86bfb12010-01-07 04:11:17 +000082#if defined(CONFIG_ROMKERNEL)
83 .data : AT(LOADADDR(.bss) + SIZEOF(.bss))
84#else
Mike Frysingerde6a9522007-06-11 17:27:05 +080085 .data :
Barry Songd86bfb12010-01-07 04:11:17 +000086#endif
Mike Frysingerde6a9522007-06-11 17:27:05 +080087 {
88 __sdata = .;
Mike Frysingerb7627ac2008-02-02 15:53:17 +080089 /* This gets done first, so the glob doesn't suck it in */
Tim Abbott4a5e3512009-09-24 10:36:23 -040090 CACHELINE_ALIGNED_DATA(32)
Mike Frysingerde6a9522007-06-11 17:27:05 +080091
Sonic Zhangb85b82d2008-04-24 06:13:37 +080092#if !L1_DATA_A_LENGTH
93 . = ALIGN(32);
94 *(.data_l1.cacheline_aligned)
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080095 *(.l1.data)
96#endif
97#if !L1_DATA_B_LENGTH
98 *(.l1.data.B)
Sonic Zhangb85b82d2008-04-24 06:13:37 +080099#endif
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800100#if !L2_LENGTH
Sonic Zhang262c3822008-07-19 15:42:41 +0800101 . = ALIGN(32);
102 *(.data_l2.cacheline_aligned)
103 *(.l2.data)
104#endif
Sonic Zhangb85b82d2008-04-24 06:13:37 +0800105
Mike Frysinger27d875f2007-08-27 16:08:53 +0800106 DATA_DATA
Mike Frysinger27d875f2007-08-27 16:08:53 +0800107 CONSTRUCTORS
108
Tim Abbott4a5e3512009-09-24 10:36:23 -0400109 INIT_TASK_DATA(THREAD_SIZE)
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800110
Mike Frysingerde6a9522007-06-11 17:27:05 +0800111 __edata = .;
112 }
Barry Songd86bfb12010-01-07 04:11:17 +0000113 __data_lma = LOADADDR(.data);
114 __data_len = SIZEOF(.data);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800115
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800116 /* The init section should be last, so when we free it, it goes into
117 * the general memory pool, and (hopefully) will decrease fragmentation
118 * a tiny bit. The init section has a _requirement_ that it be
119 * PAGE_SIZE aligned
120 */
121 . = ALIGN(PAGE_SIZE);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800122 ___init_begin = .;
Mike Frysinger27d875f2007-08-27 16:08:53 +0800123
Barry Songd86bfb12010-01-07 04:11:17 +0000124#ifdef CONFIG_RAMKERNEL
Tim Abbott4a5e3512009-09-24 10:36:23 -0400125 INIT_TEXT_SECTION(PAGE_SIZE)
Mike Frysinger70f12562009-06-07 17:18:25 -0400126
Jie Zhang0afc2722010-01-05 04:22:33 +0000127 /* We have to discard exit text and such at runtime, not link time, to
Mike Frysinger70f12562009-06-07 17:18:25 -0400128 * handle embedded cross-section references (alt instructions, bug
Jie Zhang0afc2722010-01-05 04:22:33 +0000129 * table, eh_frame, etc...). We need all of our .text up front and
130 * .data after it for PCREL call issues.
Mike Frysinger70f12562009-06-07 17:18:25 -0400131 */
132 .exit.text :
133 {
134 EXIT_TEXT
135 }
Jie Zhang0afc2722010-01-05 04:22:33 +0000136
137 . = ALIGN(16);
138 INIT_DATA_SECTION(16)
139 PERCPU(4)
140
Mike Frysinger70f12562009-06-07 17:18:25 -0400141 .exit.data :
142 {
143 EXIT_DATA
144 }
145
Tim Abbott4a5e3512009-09-24 10:36:23 -0400146 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
Barry Songd86bfb12010-01-07 04:11:17 +0000147#else
148 .init.data : AT(__data_lma + __data_len)
149 {
150 __sinitdata = .;
151 INIT_DATA
152 INIT_SETUP(16)
153 INIT_CALLS
154 CON_INITCALL
155 SECURITY_INITCALL
156 INIT_RAM_FS
157
158 . = ALIGN(4);
159 ___per_cpu_load = .;
160 ___per_cpu_start = .;
161 *(.data.percpu.first)
162 *(.data.percpu.page_aligned)
163 *(.data.percpu)
164 *(.data.percpu.shared_aligned)
165 ___per_cpu_end = .;
166
167 EXIT_DATA
168 __einitdata = .;
169 }
170 __init_data_lma = LOADADDR(.init.data);
171 __init_data_len = SIZEOF(.init.data);
172 __init_data_end = .;
173
174 .text_l1 L1_CODE_START : AT(__init_data_lma + __init_data_len)
175#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700176 {
177 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800178 __stext_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800179 *(.l1.text)
Robin Getzb8d0c772009-03-31 13:40:52 +0000180#ifdef CONFIG_SCHEDULE_L1
181 SCHED_TEXT
182#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700183 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800184 __etext_l1 = .;
185 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000186 __text_l1_lma = LOADADDR(.text_l1);
187 __text_l1_len = SIZEOF(.text_l1);
188 ASSERT (__text_l1_len <= L1_CODE_LENGTH, "L1 text overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700189
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000190 .data_l1 L1_DATA_A_START : AT(__text_l1_lma + __text_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700191 {
192 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800193 __sdata_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800194 *(.l1.data)
Mike Frysingerde6a9522007-06-11 17:27:05 +0800195 __edata_l1 = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700196
Bryan Wu1394f032007-05-06 14:50:22 -0700197 . = ALIGN(32);
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800198 *(.data_l1.cacheline_aligned)
Bryan Wu1394f032007-05-06 14:50:22 -0700199
200 . = ALIGN(4);
Sonic Zhang262c3822008-07-19 15:42:41 +0800201 __sbss_l1 = .;
202 *(.l1.bss)
203 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800204 __ebss_l1 = .;
205 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000206 __data_l1_lma = LOADADDR(.data_l1);
207 __data_l1_len = SIZEOF(.data_l1);
208 ASSERT (__data_l1_len <= L1_DATA_A_LENGTH, "L1 data A overflow!")
Mike Frysingerde6a9522007-06-11 17:27:05 +0800209
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000210 .data_b_l1 L1_DATA_B_START : AT(__data_l1_lma + __data_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700211 {
212 . = ALIGN(4);
213 __sdata_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800214 *(.l1.data.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700215 __edata_b_l1 = .;
216
217 . = ALIGN(4);
218 __sbss_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800219 *(.l1.bss.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700220 . = ALIGN(4);
221 __ebss_b_l1 = .;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800222 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000223 __data_b_l1_lma = LOADADDR(.data_b_l1);
224 __data_b_l1_len = SIZEOF(.data_b_l1);
225 ASSERT (__data_b_l1_len <= L1_DATA_B_LENGTH, "L1 data B overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700226
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000227 .text_data_l2 L2_START : AT(__data_b_l1_lma + __data_b_l1_len)
Sonic Zhang262c3822008-07-19 15:42:41 +0800228 {
229 . = ALIGN(4);
230 __stext_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800231 *(.l2.text)
Sonic Zhang262c3822008-07-19 15:42:41 +0800232 . = ALIGN(4);
233 __etext_l2 = .;
234
235 . = ALIGN(4);
236 __sdata_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800237 *(.l2.data)
Sonic Zhang262c3822008-07-19 15:42:41 +0800238 __edata_l2 = .;
239
240 . = ALIGN(32);
241 *(.data_l2.cacheline_aligned)
242
243 . = ALIGN(4);
244 __sbss_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800245 *(.l2.bss)
Sonic Zhang262c3822008-07-19 15:42:41 +0800246 . = ALIGN(4);
247 __ebss_l2 = .;
248 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000249 __l2_lma = LOADADDR(.text_data_l2);
250 __l2_len = SIZEOF(.text_data_l2);
251 ASSERT (__l2_len <= L2_LENGTH, "L2 overflow!")
Bernd Schmidt6f985292009-01-07 23:14:39 +0800252
Mike Frysinger36208052007-10-30 12:00:02 +0800253 /* Force trailing alignment of our init section so that when we
254 * free our init memory, we don't leave behind a partial page.
255 */
Barry Songd86bfb12010-01-07 04:11:17 +0000256#ifdef CONFIG_RAMKERNEL
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000257 . = __l2_lma + __l2_len;
Barry Songd86bfb12010-01-07 04:11:17 +0000258#else
259 . = __init_data_end;
260#endif
Mike Frysinger36208052007-10-30 12:00:02 +0800261 . = ALIGN(PAGE_SIZE);
262 ___init_end = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700263
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800264 __end =.;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800265
Mike Frysingerc11b5772007-10-11 00:12:41 +0800266 STABS_DEBUG
267
268 DWARF_DEBUG
269
Tejun Heo023bf6f2009-07-09 11:27:40 +0900270 DISCARDS
Bryan Wu1394f032007-05-06 14:50:22 -0700271}