blob: 1474c18fb777d13c1d07f164f50ccef1304f156b [file] [log] [blame]
Ralf Baechledbee90b2006-02-02 14:31:16 +00001#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#include <asm-generic/vmlinux.lds.h>
3
Ralf Baechle41c594a2006-04-05 09:45:45 +01004#undef mips
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#define mips mips
6OUTPUT_ARCH(mips)
7ENTRY(kernel_entry)
Ralf Baechle603bb992007-10-14 22:49:01 +01008PHDRS {
9 text PT_LOAD FLAGS(7); /* RWX */
10 note PT_NOTE FLAGS(4); /* R__ */
11}
Linus Torvalds1da177e2005-04-16 15:20:36 -070012jiffies = JIFFIES;
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014SECTIONS
15{
16#ifdef CONFIG_BOOT_ELF64
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020017 /* Read-only sections, merged into text segment: */
18 /* . = 0xc000000000000000; */
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020020 /* This is the value for an Origin kernel, taken from an IRIX kernel. */
21 /* . = 0xc00000000001c000; */
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020023 /* Set the vaddr for the text segment to a value
24 * >= 0xa800 0000 0001 9000 if no symmon is going to configured
25 * >= 0xa800 0000 0030 0000 otherwise
26 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020028 /* . = 0xa800000000300000; */
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020029 . = 0xffffffff80300000;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#endif
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020031 . = LOADADDR;
32 /* read-only */
33 _text = .; /* Text and read-only data */
34 .text : {
35 TEXT_TEXT
36 SCHED_TEXT
37 LOCK_TEXT
Ralf Baechlef70fd1b2007-10-14 22:50:05 +010038 KPROBES_TEXT
Atsushi Nemoto6b3766a2008-08-05 23:45:14 +090039 *(.text.*)
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020040 *(.fixup)
41 *(.gnu.warning)
Ralf Baechle603bb992007-10-14 22:49:01 +010042 } :text = 0
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020043 _etext = .; /* End of text section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020045 /* Exception table */
46 . = ALIGN(16);
47 __ex_table : {
48 __start___ex_table = .;
49 *(__ex_table)
50 __stop___ex_table = .;
51 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020053 /* Exception table for data bus errors */
54 __dbe_table : {
55 __start___dbe_table = .;
56 *(__dbe_table)
57 __stop___dbe_table = .;
58 }
Ralf Baechle603bb992007-10-14 22:49:01 +010059
60 NOTES :text :note
61 .dummy : { *(.dummy) } :text
62
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020063 RODATA
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020065 /* writeable */
66 .data : { /* Data */
Franck Bui-Huu16be2432007-10-18 23:12:32 +020067 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
68 /*
69 * This ALIGN is needed as a workaround for a bug a
70 * gcc bug upto 4.1 which limits the maximum alignment
71 * to at most 32kB and results in the following
72 * warning:
73 *
74 * CC arch/mips/kernel/init_task.o
75 * arch/mips/kernel/init_task.c:30: warning: alignment
76 * of ‘init_thread_union’ is greater than maximum
77 * object file alignment. Using 32768
78 */
79 . = ALIGN(_PAGE_SIZE);
80 *(.data.init_task)
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Franck Bui-Huu16be2432007-10-18 23:12:32 +020082 DATA_DATA
83 CONSTRUCTORS
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020084 }
85 _gp = . + 0x8000;
86 .lit8 : {
87 *(.lit8)
88 }
89 .lit4 : {
90 *(.lit4)
91 }
92 /* We want the small data sections together, so single-instruction offsets
93 can access them all, and initialized data all before uninitialized, so
94 we can shorten the on-disk segment size. */
95 .sdata : {
96 *(.sdata)
97 }
Maciej W. Rozycki6f6b3942007-10-01 13:24:04 +010098
Sam Ravnborg0f5c9062007-09-15 23:35:53 +020099 . = ALIGN(_PAGE_SIZE);
100 .data_nosave : {
101 __nosave_begin = .;
102 *(.data.nosave)
103 }
104 . = ALIGN(_PAGE_SIZE);
105 __nosave_end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
David Daney2dbac102008-10-13 16:36:13 -0700107 . = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200108 .data.cacheline_aligned : {
109 *(.data.cacheline_aligned)
110 }
111 _edata = .; /* End of data section */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200113 /* will be freed after init */
114 . = ALIGN(_PAGE_SIZE); /* Init code and data */
115 __init_begin = .;
116 .init.text : {
117 _sinittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100118 INIT_TEXT
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200119 _einittext = .;
120 }
121 .init.data : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100122 INIT_DATA
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200123 }
124 . = ALIGN(16);
125 .init.setup : {
126 __setup_start = .;
127 *(.init.setup)
128 __setup_end = .;
129 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200131 .initcall.init : {
132 __initcall_start = .;
133 INITCALLS
134 __initcall_end = .;
135 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200137 .con_initcall.init : {
138 __con_initcall_start = .;
139 *(.con_initcall.init)
140 __con_initcall_end = .;
141 }
142 SECURITY_INIT
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200144 /* .exit.text is discarded at runtime, not link time, to deal with
145 * references from .rodata
146 */
147 .exit.text : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100148 EXIT_TEXT
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200149 }
150 .exit.data : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100151 EXIT_DATA
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200152 }
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800153#if defined(CONFIG_BLK_DEV_INITRD)
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200154 . = ALIGN(_PAGE_SIZE);
155 .init.ramfs : {
156 __initramfs_start = .;
157 *(.init.ramfs)
158 __initramfs_end = .;
159 }
Jean-Paul Saman67d38222007-02-10 01:44:44 -0800160#endif
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200161 PERCPU(_PAGE_SIZE)
162 . = ALIGN(_PAGE_SIZE);
163 __init_end = .;
164 /* freed after init ends here */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200166 __bss_start = .; /* BSS */
167 .sbss : {
168 *(.sbss)
169 *(.scommon)
170 }
171 .bss : {
172 *(.bss)
173 *(COMMON)
174 }
175 __bss_stop = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200177 _end = . ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200179 /* These mark the ABI of the kernel for debuggers. */
180 .mdebug.abi32 : {
181 KEEP(*(.mdebug.abi32))
182 }
183 .mdebug.abi64 : {
184 KEEP(*(.mdebug.abi64))
185 }
Daniel Jacobowitz6c769882007-08-03 11:43:01 -0400186
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200187 /* This is the MIPS specific mdebug section. */
188 .mdebug : {
189 *(.mdebug)
190 }
Atsushi Nemoto78665aa2006-05-11 00:41:26 +0900191
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200192 STABS_DEBUG
193 DWARF_DEBUG
Atsushi Nemoto04b6b3b2006-05-10 15:36:04 +0900194
Sam Ravnborg0f5c9062007-09-15 23:35:53 +0200195 /* These must appear regardless of . */
196 .gptab.sdata : {
197 *(.gptab.data)
198 *(.gptab.sdata)
199 }
200 .gptab.sbss : {
201 *(.gptab.bss)
202 *(.gptab.sbss)
203 }
Tejun Heo023bf6f2009-07-09 11:27:40 +0900204
205 /* Sections to be discarded */
206 DISCARDS
207 /DISCARD/ : {
208 /* ABI crap starts here */
209 *(.MIPS.options)
210 *(.options)
211 *(.pdr)
212 *(.reginfo)
213 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214}