blob: 66799e763dc93562513b8350c737e37fad282df8 [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{
18 . = CONFIG_BOOT_LOAD;
Mike Frysingerb7627ac2008-02-02 15:53:17 +080019 /* Neither the text, ro_data or bss section need to be aligned
20 * So pack them back to back
21 */
Bryan Wu1394f032007-05-06 14:50:22 -070022 .text :
23 {
Mike Frysingerde6a9522007-06-11 17:27:05 +080024 __text = .;
25 _text = .;
26 __stext = .;
Sam Ravnborg76647092007-05-13 00:31:33 +020027 TEXT_TEXT
Robin Getzb8d0c772009-03-31 13:40:52 +000028#ifndef CONFIG_SCHEDULE_L1
Bryan Wu1394f032007-05-06 14:50:22 -070029 SCHED_TEXT
Robin Getzb8d0c772009-03-31 13:40:52 +000030#endif
Mike Frysingerde6a9522007-06-11 17:27:05 +080031 LOCK_TEXT
Mike Frysinger1ee76d72009-06-10 04:45:29 -040032 IRQENTRY_TEXT
Mike Frysinger27d875f2007-08-27 16:08:53 +080033 KPROBES_TEXT
34 *(.text.*)
Bryan Wu1394f032007-05-06 14:50:22 -070035 *(.fixup)
Bryan Wu1394f032007-05-06 14:50:22 -070036
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080037#if !L1_CODE_LENGTH
38 *(.l1.text)
39#endif
40
Mike Frysingerde6a9522007-06-11 17:27:05 +080041 . = ALIGN(16);
42 ___start___ex_table = .;
43 *(__ex_table)
44 ___stop___ex_table = .;
45
Bryan Wu1394f032007-05-06 14:50:22 -070046 __etext = .;
Mike Frysingerde6a9522007-06-11 17:27:05 +080047 }
Bryan Wu1394f032007-05-06 14:50:22 -070048
Bernd Schmidt6f985292009-01-07 23:14:39 +080049 NOTES
50
Mike Frysingerb7627ac2008-02-02 15:53:17 +080051 /* Just in case the first read only is a 32-bit access */
52 RO_DATA(4)
53
54 .bss :
55 {
56 . = ALIGN(4);
57 ___bss_start = .;
58 *(.bss .bss.*)
59 *(COMMON)
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080060#if !L1_DATA_A_LENGTH
61 *(.l1.bss)
62#endif
63#if !L1_DATA_B_LENGTH
64 *(.l1.bss.B)
65#endif
Mike Frysinger13752042008-08-06 17:10:57 +080066 . = ALIGN(4);
Mike Frysingerb7627ac2008-02-02 15:53:17 +080067 ___bss_stop = .;
68 }
Mike Frysingerde6a9522007-06-11 17:27:05 +080069
70 .data :
71 {
72 __sdata = .;
Mike Frysingerb7627ac2008-02-02 15:53:17 +080073 /* This gets done first, so the glob doesn't suck it in */
Tim Abbott4a5e3512009-09-24 10:36:23 -040074 CACHELINE_ALIGNED_DATA(32)
Mike Frysingerde6a9522007-06-11 17:27:05 +080075
Sonic Zhangb85b82d2008-04-24 06:13:37 +080076#if !L1_DATA_A_LENGTH
77 . = ALIGN(32);
78 *(.data_l1.cacheline_aligned)
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +080079 *(.l1.data)
80#endif
81#if !L1_DATA_B_LENGTH
82 *(.l1.data.B)
Sonic Zhangb85b82d2008-04-24 06:13:37 +080083#endif
Mike Frysinger07aa7be2008-08-13 16:16:11 +080084#if !L2_LENGTH
Sonic Zhang262c3822008-07-19 15:42:41 +080085 . = ALIGN(32);
86 *(.data_l2.cacheline_aligned)
87 *(.l2.data)
88#endif
Sonic Zhangb85b82d2008-04-24 06:13:37 +080089
Mike Frysinger27d875f2007-08-27 16:08:53 +080090 DATA_DATA
Mike Frysinger27d875f2007-08-27 16:08:53 +080091 CONSTRUCTORS
92
Tim Abbott4a5e3512009-09-24 10:36:23 -040093 INIT_TASK_DATA(THREAD_SIZE)
Mike Frysingerb7627ac2008-02-02 15:53:17 +080094
Mike Frysingerde6a9522007-06-11 17:27:05 +080095 __edata = .;
96 }
97
Mike Frysingerb7627ac2008-02-02 15:53:17 +080098 /* The init section should be last, so when we free it, it goes into
99 * the general memory pool, and (hopefully) will decrease fragmentation
100 * a tiny bit. The init section has a _requirement_ that it be
101 * PAGE_SIZE aligned
102 */
103 . = ALIGN(PAGE_SIZE);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800104 ___init_begin = .;
Mike Frysinger27d875f2007-08-27 16:08:53 +0800105
Tim Abbott4a5e3512009-09-24 10:36:23 -0400106 INIT_TEXT_SECTION(PAGE_SIZE)
107 . = ALIGN(16);
108 INIT_DATA_SECTION(16)
Graf Yang46fa5ee2009-01-07 23:14:39 +0800109 PERCPU(4)
Mike Frysinger70f12562009-06-07 17:18:25 -0400110
111 /* we have to discard exit text and such at runtime, not link time, to
112 * handle embedded cross-section references (alt instructions, bug
113 * table, eh_frame, etc...)
114 */
115 .exit.text :
116 {
117 EXIT_TEXT
118 }
119 .exit.data :
120 {
121 EXIT_DATA
122 }
123
Tim Abbott4a5e3512009-09-24 10:36:23 -0400124 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
Bryan Wu1394f032007-05-06 14:50:22 -0700125 {
126 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800127 __stext_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800128 *(.l1.text)
Robin Getzb8d0c772009-03-31 13:40:52 +0000129#ifdef CONFIG_SCHEDULE_L1
130 SCHED_TEXT
131#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700132 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800133 __etext_l1 = .;
134 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000135 __text_l1_lma = LOADADDR(.text_l1);
136 __text_l1_len = SIZEOF(.text_l1);
137 ASSERT (__text_l1_len <= L1_CODE_LENGTH, "L1 text overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700138
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000139 .data_l1 L1_DATA_A_START : AT(__text_l1_lma + __text_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700140 {
141 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800142 __sdata_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800143 *(.l1.data)
Mike Frysingerde6a9522007-06-11 17:27:05 +0800144 __edata_l1 = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700145
Bryan Wu1394f032007-05-06 14:50:22 -0700146 . = ALIGN(32);
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800147 *(.data_l1.cacheline_aligned)
Bryan Wu1394f032007-05-06 14:50:22 -0700148
149 . = ALIGN(4);
Sonic Zhang262c3822008-07-19 15:42:41 +0800150 __sbss_l1 = .;
151 *(.l1.bss)
152 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800153 __ebss_l1 = .;
154 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000155 __data_l1_lma = LOADADDR(.data_l1);
156 __data_l1_len = SIZEOF(.data_l1);
157 ASSERT (__data_l1_len <= L1_DATA_A_LENGTH, "L1 data A overflow!")
Mike Frysingerde6a9522007-06-11 17:27:05 +0800158
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000159 .data_b_l1 L1_DATA_B_START : AT(__data_l1_lma + __data_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700160 {
161 . = ALIGN(4);
162 __sdata_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800163 *(.l1.data.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700164 __edata_b_l1 = .;
165
166 . = ALIGN(4);
167 __sbss_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800168 *(.l1.bss.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700169 . = ALIGN(4);
170 __ebss_b_l1 = .;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800171 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000172 __data_b_l1_lma = LOADADDR(.data_b_l1);
173 __data_b_l1_len = SIZEOF(.data_b_l1);
174 ASSERT (__data_b_l1_len <= L1_DATA_B_LENGTH, "L1 data B overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700175
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000176 .text_data_l2 L2_START : AT(__data_b_l1_lma + __data_b_l1_len)
Sonic Zhang262c3822008-07-19 15:42:41 +0800177 {
178 . = ALIGN(4);
179 __stext_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800180 *(.l2.text)
Sonic Zhang262c3822008-07-19 15:42:41 +0800181 . = ALIGN(4);
182 __etext_l2 = .;
183
184 . = ALIGN(4);
185 __sdata_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800186 *(.l2.data)
Sonic Zhang262c3822008-07-19 15:42:41 +0800187 __edata_l2 = .;
188
189 . = ALIGN(32);
190 *(.data_l2.cacheline_aligned)
191
192 . = ALIGN(4);
193 __sbss_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800194 *(.l2.bss)
Sonic Zhang262c3822008-07-19 15:42:41 +0800195 . = ALIGN(4);
196 __ebss_l2 = .;
197 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000198 __l2_lma = LOADADDR(.text_data_l2);
199 __l2_len = SIZEOF(.text_data_l2);
200 ASSERT (__l2_len <= L2_LENGTH, "L2 overflow!")
Bernd Schmidt6f985292009-01-07 23:14:39 +0800201
Mike Frysinger36208052007-10-30 12:00:02 +0800202 /* Force trailing alignment of our init section so that when we
203 * free our init memory, we don't leave behind a partial page.
204 */
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000205 . = __l2_lma + __l2_len;
Mike Frysinger36208052007-10-30 12:00:02 +0800206 . = ALIGN(PAGE_SIZE);
207 ___init_end = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700208
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800209 __end =.;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800210
Mike Frysingerc11b5772007-10-11 00:12:41 +0800211 STABS_DEBUG
212
213 DWARF_DEBUG
214
Tejun Heo023bf6f2009-07-09 11:27:40 +0900215 DISCARDS
Bryan Wu1394f032007-05-06 14:50:22 -0700216}