xref: /linux/arch/mips/kernel/vmlinux.lds.S (revision a0b54e256d513ed99e456bea6e4e188ff92e7c46)
1#include <asm/asm-offsets.h>
2#include <asm/page.h>
3#include <asm-generic/vmlinux.lds.h>
4
5#undef mips
6#define mips mips
7OUTPUT_ARCH(mips)
8ENTRY(kernel_entry)
9PHDRS {
10	text PT_LOAD FLAGS(7);	/* RWX */
11	note PT_NOTE FLAGS(4);	/* R__ */
12}
13jiffies = JIFFIES;
14
15SECTIONS
16{
17#ifdef CONFIG_BOOT_ELF64
18	/* Read-only sections, merged into text segment: */
19	/* . = 0xc000000000000000; */
20
21	/* This is the value for an Origin kernel, taken from an IRIX kernel.  */
22	/* . = 0xc00000000001c000; */
23
24	/* 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	 */
28
29	/* . = 0xa800000000300000; */
30	. = 0xffffffff80300000;
31#endif
32	. = LOADADDR;
33	/* read-only */
34	_text = .;	/* Text and read-only data */
35	.text : {
36		TEXT_TEXT
37		SCHED_TEXT
38		LOCK_TEXT
39		KPROBES_TEXT
40		*(.text.*)
41		*(.fixup)
42		*(.gnu.warning)
43	} :text = 0
44	_etext = .;	/* End of text section */
45
46	/* Exception table */
47	. = ALIGN(16);
48	__ex_table : {
49		__start___ex_table = .;
50		*(__ex_table)
51		__stop___ex_table = .;
52	}
53
54	/* Exception table for data bus errors */
55	__dbe_table : {
56		__start___dbe_table = .;
57		*(__dbe_table)
58		__stop___dbe_table = .;
59	}
60
61	NOTES :text :note
62	.dummy : { *(.dummy) } :text
63
64	RODATA
65
66	/* writeable */
67	.data : {	/* Data */
68		. = . + 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		 */
80		. = ALIGN(PAGE_SIZE);
81		*(.data.init_task)
82
83		DATA_DATA
84		CONSTRUCTORS
85	}
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	}
99
100	. = ALIGN(PAGE_SIZE);
101	.data_nosave : {
102		__nosave_begin = .;
103		*(.data.nosave)
104	}
105	. = ALIGN(PAGE_SIZE);
106	__nosave_end = .;
107
108	. = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
109	.data.cacheline_aligned : {
110		*(.data.cacheline_aligned)
111	}
112	_edata =  .;			/* End of data section */
113
114	/* will be freed after init */
115	. = ALIGN(PAGE_SIZE);		/* Init code and data */
116	__init_begin = .;
117	.init.text : {
118		_sinittext = .;
119		INIT_TEXT
120		_einittext = .;
121	}
122	.init.data : {
123		INIT_DATA
124	}
125	. = ALIGN(16);
126	.init.setup : {
127		__setup_start = .;
128		*(.init.setup)
129		__setup_end = .;
130	}
131
132	.initcall.init : {
133		__initcall_start = .;
134		INITCALLS
135		__initcall_end = .;
136	}
137
138	.con_initcall.init : {
139		__con_initcall_start = .;
140		*(.con_initcall.init)
141		__con_initcall_end = .;
142	}
143	SECURITY_INIT
144
145	/* .exit.text is discarded at runtime, not link time, to deal with
146	 * references from .rodata
147	 */
148	.exit.text : {
149		EXIT_TEXT
150	}
151	.exit.data : {
152		EXIT_DATA
153	}
154#if defined(CONFIG_BLK_DEV_INITRD)
155	. = ALIGN(PAGE_SIZE);
156	.init.ramfs : {
157		__initramfs_start = .;
158		*(.init.ramfs)
159		__initramfs_end = .;
160	}
161#endif
162	PERCPU(PAGE_SIZE)
163	. = ALIGN(PAGE_SIZE);
164	__init_end = .;
165	/* freed after init ends here */
166
167	__bss_start = .;	/* BSS */
168	.sbss  : {
169		*(.sbss)
170		*(.scommon)
171	}
172	.bss : {
173		*(.bss)
174		*(COMMON)
175	}
176	__bss_stop = .;
177
178	_end = . ;
179
180	/* 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	}
187
188	/* This is the MIPS specific mdebug section.  */
189	.mdebug : {
190		*(.mdebug)
191	}
192
193	STABS_DEBUG
194	DWARF_DEBUG
195
196	/* 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	}
205
206	/* Sections to be discarded */
207	DISCARDS
208	/DISCARD/ : {
209		/* ABI crap starts here */
210		*(.MIPS.options)
211		*(.options)
212		*(.pdr)
213		*(.reginfo)
214	}
215}
216