ARM: vmlinux.lds: move discarded sections to beginning
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / kernel / vmlinux.lds.S
blobcb46a9bad4f5d8acb00127b57824670ca53e7c5f
1 /* ld script to make ARM Linux kernel
2  * taken from the i386 version by Russell King
3  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
4  */
6 #include <asm-generic/vmlinux.lds.h>
7 #include <asm/thread_info.h>
8 #include <asm/memory.h>
9 #include <asm/page.h>
10         
11 #define PROC_INFO                                                       \
12         VMLINUX_SYMBOL(__proc_info_begin) = .;                          \
13         *(.proc.info.init)                                              \
14         VMLINUX_SYMBOL(__proc_info_end) = .;
16 #ifdef CONFIG_HOTPLUG_CPU
17 #define ARM_CPU_DISCARD(x)
18 #define ARM_CPU_KEEP(x)         x
19 #else
20 #define ARM_CPU_DISCARD(x)      x
21 #define ARM_CPU_KEEP(x)
22 #endif
24 #if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)
25 #define ARM_EXIT_KEEP(x)        x
26 #else
27 #define ARM_EXIT_KEEP(x)
28 #endif
30 OUTPUT_ARCH(arm)
31 ENTRY(stext)
33 #ifndef __ARMEB__
34 jiffies = jiffies_64;
35 #else
36 jiffies = jiffies_64 + 4;
37 #endif
39 SECTIONS
41         /*
42          * unwind exit sections must be discarded before the rest of the
43          * unwind sections get included.
44          */
45         /DISCARD/ : {
46                 *(.ARM.exidx.exit.text)
47                 *(.ARM.extab.exit.text)
48                 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
49                 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
50 #ifndef CONFIG_HOTPLUG
51                 *(.ARM.exidx.devexit.text)
52                 *(.ARM.extab.devexit.text)
53 #endif
54 #ifndef CONFIG_MMU
55                 *(.fixup)
56                 *(__ex_table)
57 #endif
58 #ifndef CONFIG_SMP_ON_UP
59                 *(.alt.smp.init)
60 #endif
61         }
63 #ifdef CONFIG_XIP_KERNEL
64         . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
65 #else
66         . = PAGE_OFFSET + TEXT_OFFSET;
67 #endif
69         .init : {                       /* Init code and data           */
70                 _stext = .;
71                 _sinittext = .;
72                         HEAD_TEXT
73                         INIT_TEXT
74                         ARM_EXIT_KEEP(EXIT_TEXT)
75                 _einittext = .;
76                 ARM_CPU_DISCARD(PROC_INFO)
77                 __arch_info_begin = .;
78                         *(.arch.info.init)
79                 __arch_info_end = .;
80                 __tagtable_begin = .;
81                         *(.taglist.init)
82                 __tagtable_end = .;
83 #ifdef CONFIG_SMP_ON_UP
84                 __smpalt_begin = .;
85                         *(.alt.smp.init)
86                 __smpalt_end = .;
87 #endif
89                 __pv_table_begin = .;
90                         *(.pv_table)
91                 __pv_table_end = .;
93                 INIT_SETUP(16)
95                 INIT_CALLS
96                 CON_INITCALL
97                 SECURITY_INITCALL
98                 INIT_RAM_FS
100 #ifndef CONFIG_XIP_KERNEL
101                 __init_begin = _stext;
102                 INIT_DATA
103                 ARM_EXIT_KEEP(EXIT_DATA)
104 #endif
105         }
107         PERCPU_SECTION(32)
109 #ifndef CONFIG_XIP_KERNEL
110         . = ALIGN(PAGE_SIZE);
111         __init_end = .;
112 #endif
114         .text : {                       /* Real text segment            */
115                 _text = .;              /* Text and read-only data      */
116                         __exception_text_start = .;
117                         *(.exception.text)
118                         __exception_text_end = .;
119                         IRQENTRY_TEXT
120                         TEXT_TEXT
121                         SCHED_TEXT
122                         LOCK_TEXT
123                         KPROBES_TEXT
124 #ifdef CONFIG_MMU
125                         *(.fixup)
126 #endif
127                         *(.gnu.warning)
128                         *(.rodata)
129                         *(.rodata.*)
130                         *(.glue_7)
131                         *(.glue_7t)
132                 . = ALIGN(4);
133                 *(.got)                 /* Global offset table          */
134                         ARM_CPU_KEEP(PROC_INFO)
135         }
137         RO_DATA(PAGE_SIZE)
139 #ifdef CONFIG_ARM_UNWIND
140         /*
141          * Stack unwinding tables
142          */
143         . = ALIGN(8);
144         .ARM.unwind_idx : {
145                 __start_unwind_idx = .;
146                 *(.ARM.exidx*)
147                 __stop_unwind_idx = .;
148         }
149         .ARM.unwind_tab : {
150                 __start_unwind_tab = .;
151                 *(.ARM.extab*)
152                 __stop_unwind_tab = .;
153         }
154 #endif
156         _etext = .;                     /* End of text and rodata section */
158 #ifdef CONFIG_XIP_KERNEL
159         __data_loc = ALIGN(4);          /* location in binary */
160         . = PAGE_OFFSET + TEXT_OFFSET;
161 #else
162         . = ALIGN(THREAD_SIZE);
163         __data_loc = .;
164 #endif
166         .data : AT(__data_loc) {
167                 _data = .;              /* address in memory */
168                 _sdata = .;
170                 /*
171                  * first, the init task union, aligned
172                  * to an 8192 byte boundary.
173                  */
174                 INIT_TASK_DATA(THREAD_SIZE)
176 #ifdef CONFIG_XIP_KERNEL
177                 . = ALIGN(PAGE_SIZE);
178                 __init_begin = .;
179                 INIT_DATA
180                 ARM_EXIT_KEEP(EXIT_DATA)
181                 . = ALIGN(PAGE_SIZE);
182                 __init_end = .;
183 #endif
185                 NOSAVE_DATA
186                 CACHELINE_ALIGNED_DATA(32)
187                 READ_MOSTLY_DATA(32)
189                 /*
190                  * The exception fixup table (might need resorting at runtime)
191                  */
192                 . = ALIGN(32);
193                 __start___ex_table = .;
194 #ifdef CONFIG_MMU
195                 *(__ex_table)
196 #endif
197                 __stop___ex_table = .;
199                 /*
200                  * and the usual data section
201                  */
202                 DATA_DATA
203                 CONSTRUCTORS
205                 _edata = .;
206         }
207         _edata_loc = __data_loc + SIZEOF(.data);
209 #ifdef CONFIG_HAVE_TCM
210         /*
211          * We align everything to a page boundary so we can
212          * free it after init has commenced and TCM contents have
213          * been copied to its destination.
214          */
215         .tcm_start : {
216                 . = ALIGN(PAGE_SIZE);
217                 __tcm_start = .;
218                 __itcm_start = .;
219         }
221         /*
222          * Link these to the ITCM RAM
223          * Put VMA to the TCM address and LMA to the common RAM
224          * and we'll upload the contents from RAM to TCM and free
225          * the used RAM after that.
226          */
227         .text_itcm ITCM_OFFSET : AT(__itcm_start)
228         {
229                 __sitcm_text = .;
230                 *(.tcm.text)
231                 *(.tcm.rodata)
232                 . = ALIGN(4);
233                 __eitcm_text = .;
234         }
236         /*
237          * Reset the dot pointer, this is needed to create the
238          * relative __dtcm_start below (to be used as extern in code).
239          */
240         . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
242         .dtcm_start : {
243                 __dtcm_start = .;
244         }
246         /* TODO: add remainder of ITCM as well, that can be used for data! */
247         .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
248         {
249                 . = ALIGN(4);
250                 __sdtcm_data = .;
251                 *(.tcm.data)
252                 . = ALIGN(4);
253                 __edtcm_data = .;
254         }
256         /* Reset the dot pointer or the linker gets confused */
257         . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
259         /* End marker for freeing TCM copy in linked object */
260         .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
261                 . = ALIGN(PAGE_SIZE);
262                 __tcm_end = .;
263         }
264 #endif
266         NOTES
268         BSS_SECTION(0, 0, 0)
269         _end = .;
271         STABS_DEBUG
272         .comment 0 : { *(.comment) }
274         /* Default discards */
275         DISCARDS
279  * These must never be empty
280  * If you have to comment these two assert statements out, your
281  * binutils is too old (for other reasons as well)
282  */
283 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
284 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")