blob: ae8c1976df5fe5250ca0014b30228f3cb9c75688 [file] [log] [blame]
Ralf Baechledbee90b2006-02-02 14:31:16 +00001#include <asm/asm-offsets.h>
Nelson Elhagea0b54e22009-07-31 16:58:18 -04002#include <asm/page.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07003#include <asm-generic/vmlinux.lds.h>
4
Ralf Baechle41c594a2006-04-05 09:45:45 +01005#undef mips
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#define mips mips
7OUTPUT_ARCH(mips)
8ENTRY(kernel_entry)
Ralf Baechle603bb992007-10-14 22:49:01 +01009PHDRS {
10 text PT_LOAD FLAGS(7); /* RWX */
11 note PT_NOTE FLAGS(4); /* R__ */
12}
Linus Torvalds1da177e2005-04-16 15:20:36 -070013jiffies = JIFFIES;
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020014
Linus Torvalds1da177e2005-04-16 15:20:36 -070015SECTIONS
16{
17#ifdef CONFIG_BOOT_ELF64
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020018 /* Read-only sections, merged into text segment: */
19 /* . = 0xc000000000000000; */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020021 /* This is the value for an Origin kernel, taken from an IRIX kernel. */
22 /* . = 0xc00000000001c000; */
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020024 /* Set the vaddr for the text segment to a value
25 * >= 0xa800 0000 0001 9000 if no symmon is going to configured
26 * >= 0xa800 0000 0030 0000 otherwise
27 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020029 /* . = 0xa800000000300000; */
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020030 . = 0xffffffff80300000;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#endif
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020032 . = LOADADDR;
33 /* read-only */
34 _text = .; /* Text and read-only data */
35 .text : {
36 TEXT_TEXT
37 SCHED_TEXT
38 LOCK_TEXT
Ralf Baechlef70fd1b2007-10-14 22:50:05 +010039 KPROBES_TEXT
Atsushi Nemoto6b3766a2008-08-05 23:45:14 +090040 *(.text.*)
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020041 *(.fixup)
42 *(.gnu.warning)
Ralf Baechle603bb992007-10-14 22:49:01 +010043 } :text = 0
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020044 _etext = .; /* End of text section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020046 /* Exception table */
47 . = ALIGN(16);
48 __ex_table : {
49 __start___ex_table = .;
50 *(__ex_table)
51 __stop___ex_table = .;
52 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020054 /* Exception table for data bus errors */
55 __dbe_table : {
56 __start___dbe_table = .;
57 *(__dbe_table)
58 __stop___dbe_table = .;
59 }
Ralf Baechle603bb992007-10-14 22:49:01 +010060
61 NOTES :text :note
62 .dummy : { *(.dummy) } :text
63
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020064 RODATA
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020066 /* writeable */
67 .data : { /* Data */
Franck Bui-Huu16be2432007-10-18 23:12:32 +020068 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
69 /*
70 * This ALIGN is needed as a workaround for a bug a
71 * gcc bug upto 4.1 which limits the maximum alignment
72 * to at most 32kB and results in the following
73 * warning:
74 *
75 * CC arch/mips/kernel/init_task.o
76 * arch/mips/kernel/init_task.c:30: warning: alignment
77 * of ‘init_thread_union’ is greater than maximum
78 * object file alignment. Using 32768
79 */
Nelson Elhagea0b54e22009-07-31 16:58:18 -040080 . = ALIGN(PAGE_SIZE);
Franck Bui-Huu16be2432007-10-18 23:12:32 +020081 *(.data.init_task)
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
Franck Bui-Huu16be2432007-10-18 23:12:32 +020083 DATA_DATA
84 CONSTRUCTORS
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020085 }
86 _gp = . + 0x8000;
87 .lit8 : {
88 *(.lit8)
89 }
90 .lit4 : {
91 *(.lit4)
92 }
93 /* We want the small data sections together, so single-instruction offsets
94 can access them all, and initialized data all before uninitialized, so
95 we can shorten the on-disk segment size. */
96 .sdata : {
97 *(.sdata)
98 }
Maciej W. Rozycki6f6b3942007-10-01 13:24:04 +010099
Nelson Elhagea0b54e22009-07-31 16:58:18 -0400100 . = ALIGN(PAGE_SIZE);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200101 .data_nosave : {
102 __nosave_begin = .;
103 *(.data.nosave)
104 }
Nelson Elhagea0b54e22009-07-31 16:58:18 -0400105 . = ALIGN(PAGE_SIZE);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200106 __nosave_end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
David Daney2dbac102008-10-13 16:36:13 -0700108 . = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200109 .data.cacheline_aligned : {
110 *(.data.cacheline_aligned)
111 }
112 _edata = .; /* End of data section */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200114 /* will be freed after init */
Nelson Elhagea0b54e22009-07-31 16:58:18 -0400115 . = ALIGN(PAGE_SIZE); /* Init code and data */
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200116 __init_begin = .;
117 .init.text : {
118 _sinittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100119 INIT_TEXT
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200120 _einittext = .;
121 }
122 .init.data : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100123 INIT_DATA
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200124 }
125 . = ALIGN(16);
126 .init.setup : {
127 __setup_start = .;
128 *(.init.setup)
129 __setup_end = .;
130 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200132 .initcall.init : {
133 __initcall_start = .;
134 INITCALLS
135 __initcall_end = .;
136 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200138 .con_initcall.init : {
139 __con_initcall_start = .;
140 *(.con_initcall.init)
141 __con_initcall_end = .;
142 }
143 SECURITY_INIT
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200145 /* .exit.text is discarded at runtime, not link time, to deal with
146 * references from .rodata
147 */
148 .exit.text : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100149 EXIT_TEXT
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200150 }
151 .exit.data : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100152 EXIT_DATA
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200153 }
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800154#if defined(CONFIG_BLK_DEV_INITRD)
Nelson Elhagea0b54e22009-07-31 16:58:18 -0400155 . = ALIGN(PAGE_SIZE);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200156 .init.ramfs : {
157 __initramfs_start = .;
158 *(.init.ramfs)
159 __initramfs_end = .;
160 }
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800161#endif
Nelson Elhagea0b54e22009-07-31 16:58:18 -0400162 PERCPU(PAGE_SIZE)
163 . = ALIGN(PAGE_SIZE);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200164 __init_end = .;
165 /* freed after init ends here */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200167 __bss_start = .; /* BSS */
168 .sbss : {
169 *(.sbss)
170 *(.scommon)
171 }
172 .bss : {
173 *(.bss)
174 *(COMMON)
175 }
176 __bss_stop = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200178 _end = . ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200180 /* These mark the ABI of the kernel for debuggers. */
181 .mdebug.abi32 : {
182 KEEP(*(.mdebug.abi32))
183 }
184 .mdebug.abi64 : {
185 KEEP(*(.mdebug.abi64))
186 }
Daniel Jacobowitz6c769882007-08-03 11:43:01 -0400187
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200188 /* This is the MIPS specific mdebug section. */
189 .mdebug : {
190 *(.mdebug)
191 }
Atsushi Nemoto78665aa2006-05-11 00:41:26 +0900192
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200193 STABS_DEBUG
194 DWARF_DEBUG
Atsushi Nemoto04b6b3b2006-05-10 15:36:04 +0900195
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200196 /* These must appear regardless of . */
197 .gptab.sdata : {
198 *(.gptab.data)
199 *(.gptab.sdata)
200 }
201 .gptab.sbss : {
202 *(.gptab.bss)
203 *(.gptab.sbss)
204 }
Tejun Heo023bf6f2009-07-09 11:27:40 +0900205
206 /* Sections to be discarded */
207 DISCARDS
208 /DISCARD/ : {
209 /* ABI crap starts here */
210 *(.MIPS.options)
211 *(.options)
212 *(.pdr)
213 *(.reginfo)
214 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215}