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