Blackfin: fix relocation errors with large initramfs images
[safe/jmp/linux-2.6] / arch / blackfin / kernel / vmlinux.lds.S
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
3  *
4  * Licensed under the GPL-2 or later
5  */
6
7 #include <asm-generic/vmlinux.lds.h>
8 #include <asm/mem_map.h>
9 #include <asm/page.h>
10 #include <asm/thread_info.h>
11
12 OUTPUT_FORMAT("elf32-bfin")
13 ENTRY(__start)
14 _jiffies = _jiffies_64;
15
16 SECTIONS
17 {
18         . = CONFIG_BOOT_LOAD;
19         /* Neither the text, ro_data or bss section need to be aligned
20          * So pack them back to back
21          */
22         .text :
23         {
24                 __text = .;
25                 _text = .;
26                 __stext = .;
27                 TEXT_TEXT
28 #ifndef CONFIG_SCHEDULE_L1
29                 SCHED_TEXT
30 #endif
31                 LOCK_TEXT
32                 IRQENTRY_TEXT
33                 KPROBES_TEXT
34                 *(.text.*)
35                 *(.fixup)
36
37 #if !L1_CODE_LENGTH
38                 *(.l1.text)
39 #endif
40
41                 . = ALIGN(16);
42                 ___start___ex_table = .;
43                 *(__ex_table)
44                 ___stop___ex_table = .;
45
46                 __etext = .;
47         }
48
49         NOTES
50
51         /* 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)
60 #if !L1_DATA_A_LENGTH
61                 *(.l1.bss)
62 #endif
63 #if !L1_DATA_B_LENGTH
64                 *(.l1.bss.B)
65 #endif
66                 . = ALIGN(4);
67                 ___bss_stop = .;
68         }
69
70         .data :
71         {
72                 __sdata = .;
73                 /* This gets done first, so the glob doesn't suck it in */
74                 CACHELINE_ALIGNED_DATA(32)
75
76 #if !L1_DATA_A_LENGTH
77                 . = ALIGN(32);
78                 *(.data_l1.cacheline_aligned)
79                 *(.l1.data)
80 #endif
81 #if !L1_DATA_B_LENGTH
82                 *(.l1.data.B)
83 #endif
84 #if !L2_LENGTH
85                 . = ALIGN(32);
86                 *(.data_l2.cacheline_aligned)
87                 *(.l2.data)
88 #endif
89
90                 DATA_DATA
91                 CONSTRUCTORS
92
93                 INIT_TASK_DATA(THREAD_SIZE)
94
95                 __edata = .;
96         }
97
98         /* 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);
104         ___init_begin = .;
105
106         INIT_TEXT_SECTION(PAGE_SIZE)
107
108         /* We have to discard exit text and such at runtime, not link time, to
109          * handle embedded cross-section references (alt instructions, bug
110          * table, eh_frame, etc...).  We need all of our .text up front and
111          * .data after it for PCREL call issues.
112          */
113         .exit.text :
114         {
115                 EXIT_TEXT
116         }
117
118         . = ALIGN(16);
119         INIT_DATA_SECTION(16)
120         PERCPU(4)
121
122         .exit.data :
123         {
124                 EXIT_DATA
125         }
126
127         .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
128         {
129                 . = ALIGN(4);
130                 __stext_l1 = .;
131                 *(.l1.text)
132 #ifdef CONFIG_SCHEDULE_L1
133                 SCHED_TEXT
134 #endif
135                 . = ALIGN(4);
136                 __etext_l1 = .;
137         }
138         __text_l1_lma = LOADADDR(.text_l1);
139         __text_l1_len = SIZEOF(.text_l1);
140         ASSERT (__text_l1_len <= L1_CODE_LENGTH, "L1 text overflow!")
141
142         .data_l1 L1_DATA_A_START : AT(__text_l1_lma + __text_l1_len)
143         {
144                 . = ALIGN(4);
145                 __sdata_l1 = .;
146                 *(.l1.data)
147                 __edata_l1 = .;
148
149                 . = ALIGN(32);
150                 *(.data_l1.cacheline_aligned)
151
152                 . = ALIGN(4);
153                 __sbss_l1 = .;
154                 *(.l1.bss)
155                 . = ALIGN(4);
156                 __ebss_l1 = .;
157         }
158         __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!")
161
162         .data_b_l1 L1_DATA_B_START : AT(__data_l1_lma + __data_l1_len)
163         {
164                 . = ALIGN(4);
165                 __sdata_b_l1 = .;
166                 *(.l1.data.B)
167                 __edata_b_l1 = .;
168
169                 . = ALIGN(4);
170                 __sbss_b_l1 = .;
171                 *(.l1.bss.B)
172                 . = ALIGN(4);
173                 __ebss_b_l1 = .;
174         }
175         __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!")
178
179         .text_data_l2 L2_START : AT(__data_b_l1_lma + __data_b_l1_len)
180         {
181                 . = ALIGN(4);
182                 __stext_l2 = .;
183                 *(.l2.text)
184                 . = ALIGN(4);
185                 __etext_l2 = .;
186
187                 . = ALIGN(4);
188                 __sdata_l2 = .;
189                 *(.l2.data)
190                 __edata_l2 = .;
191
192                 . = ALIGN(32);
193                 *(.data_l2.cacheline_aligned)
194
195                 . = ALIGN(4);
196                 __sbss_l2 = .;
197                 *(.l2.bss)
198                 . = ALIGN(4);
199                 __ebss_l2 = .;
200         }
201         __l2_lma = LOADADDR(.text_data_l2);
202         __l2_len = SIZEOF(.text_data_l2);
203         ASSERT (__l2_len <= L2_LENGTH, "L2 overflow!")
204
205         /* 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          */
208         . = __l2_lma + __l2_len;
209         . = ALIGN(PAGE_SIZE);
210         ___init_end = .;
211
212         __end =.;
213
214         STABS_DEBUG
215
216         DWARF_DEBUG
217
218         DISCARDS
219 }