blob: be4b1bbb3918e005ef4fda35ead039ebe4d570e3 [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)
Mike Frysinger70f12562009-06-07 17:18:25 -0400107
Jie Zhang0afc2722010-01-05 04:22:33 +0000108 /* We have to discard exit text and such at runtime, not link time, to
Mike Frysinger70f12562009-06-07 17:18:25 -0400109 * handle embedded cross-section references (alt instructions, bug
Jie Zhang0afc2722010-01-05 04:22:33 +0000110 * table, eh_frame, etc...). We need all of our .text up front and
111 * .data after it for PCREL call issues.
Mike Frysinger70f12562009-06-07 17:18:25 -0400112 */
113 .exit.text :
114 {
115 EXIT_TEXT
116 }
Jie Zhang0afc2722010-01-05 04:22:33 +0000117
118 . = ALIGN(16);
119 INIT_DATA_SECTION(16)
120 PERCPU(4)
121
Mike Frysinger70f12562009-06-07 17:18:25 -0400122 .exit.data :
123 {
124 EXIT_DATA
125 }
126
Tim Abbott4a5e3512009-09-24 10:36:23 -0400127 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
Bryan Wu1394f032007-05-06 14:50:22 -0700128 {
129 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800130 __stext_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800131 *(.l1.text)
Robin Getzb8d0c772009-03-31 13:40:52 +0000132#ifdef CONFIG_SCHEDULE_L1
133 SCHED_TEXT
134#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700135 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800136 __etext_l1 = .;
137 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000138 __text_l1_lma = LOADADDR(.text_l1);
139 __text_l1_len = SIZEOF(.text_l1);
140 ASSERT (__text_l1_len <= L1_CODE_LENGTH, "L1 text overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700141
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000142 .data_l1 L1_DATA_A_START : AT(__text_l1_lma + __text_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700143 {
144 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800145 __sdata_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800146 *(.l1.data)
Mike Frysingerde6a9522007-06-11 17:27:05 +0800147 __edata_l1 = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700148
Bryan Wu1394f032007-05-06 14:50:22 -0700149 . = ALIGN(32);
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800150 *(.data_l1.cacheline_aligned)
Bryan Wu1394f032007-05-06 14:50:22 -0700151
152 . = ALIGN(4);
Sonic Zhang262c3822008-07-19 15:42:41 +0800153 __sbss_l1 = .;
154 *(.l1.bss)
155 . = ALIGN(4);
Mike Frysingerde6a9522007-06-11 17:27:05 +0800156 __ebss_l1 = .;
157 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000158 __data_l1_lma = LOADADDR(.data_l1);
159 __data_l1_len = SIZEOF(.data_l1);
160 ASSERT (__data_l1_len <= L1_DATA_A_LENGTH, "L1 data A overflow!")
Mike Frysingerde6a9522007-06-11 17:27:05 +0800161
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000162 .data_b_l1 L1_DATA_B_START : AT(__data_l1_lma + __data_l1_len)
Bryan Wu1394f032007-05-06 14:50:22 -0700163 {
164 . = ALIGN(4);
165 __sdata_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800166 *(.l1.data.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700167 __edata_b_l1 = .;
168
169 . = ALIGN(4);
170 __sbss_b_l1 = .;
Mike Frysingerbc6e0fa2008-04-24 06:21:25 +0800171 *(.l1.bss.B)
Bryan Wu1394f032007-05-06 14:50:22 -0700172 . = ALIGN(4);
173 __ebss_b_l1 = .;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800174 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000175 __data_b_l1_lma = LOADADDR(.data_b_l1);
176 __data_b_l1_len = SIZEOF(.data_b_l1);
177 ASSERT (__data_b_l1_len <= L1_DATA_B_LENGTH, "L1 data B overflow!")
Bryan Wu1394f032007-05-06 14:50:22 -0700178
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000179 .text_data_l2 L2_START : AT(__data_b_l1_lma + __data_b_l1_len)
Sonic Zhang262c3822008-07-19 15:42:41 +0800180 {
181 . = ALIGN(4);
182 __stext_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800183 *(.l2.text)
Sonic Zhang262c3822008-07-19 15:42:41 +0800184 . = ALIGN(4);
185 __etext_l2 = .;
186
187 . = ALIGN(4);
188 __sdata_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800189 *(.l2.data)
Sonic Zhang262c3822008-07-19 15:42:41 +0800190 __edata_l2 = .;
191
192 . = ALIGN(32);
193 *(.data_l2.cacheline_aligned)
194
195 . = ALIGN(4);
196 __sbss_l2 = .;
Mike Frysinger07aa7be2008-08-13 16:16:11 +0800197 *(.l2.bss)
Sonic Zhang262c3822008-07-19 15:42:41 +0800198 . = ALIGN(4);
199 __ebss_l2 = .;
200 }
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000201 __l2_lma = LOADADDR(.text_data_l2);
202 __l2_len = SIZEOF(.text_data_l2);
203 ASSERT (__l2_len <= L2_LENGTH, "L2 overflow!")
Bernd Schmidt6f985292009-01-07 23:14:39 +0800204
Mike Frysinger36208052007-10-30 12:00:02 +0800205 /* Force trailing alignment of our init section so that when we
206 * free our init memory, we don't leave behind a partial page.
207 */
Mike Frysinger5cd82a62009-09-23 20:34:48 +0000208 . = __l2_lma + __l2_len;
Mike Frysinger36208052007-10-30 12:00:02 +0800209 . = ALIGN(PAGE_SIZE);
210 ___init_end = .;
Bryan Wu1394f032007-05-06 14:50:22 -0700211
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800212 __end =.;
Mike Frysingerde6a9522007-06-11 17:27:05 +0800213
Mike Frysingerc11b5772007-10-11 00:12:41 +0800214 STABS_DEBUG
215
216 DWARF_DEBUG
217
Tejun Heo023bf6f2009-07-09 11:27:40 +0900218 DISCARDS
Bryan Wu1394f032007-05-06 14:50:22 -0700219}