xref: /openbmc/linux/arch/mips/kernel/vmlinux.lds.S (revision fd589a8f)
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(16)
47
48	/* Exception table for data bus errors */
49	__dbe_table : {
50		__start___dbe_table = .;
51		*(__dbe_table)
52		__stop___dbe_table = .;
53	}
54
55	NOTES :text :note
56	.dummy : { *(.dummy) } :text
57
58	RODATA
59
60	/* writeable */
61	.data : {	/* Data */
62		. = . + DATAOFFSET;		/* for CONFIG_MAPPED_KERNEL */
63
64		INIT_TASK_DATA(PAGE_SIZE)
65		NOSAVE_DATA
66		CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
67		DATA_DATA
68		CONSTRUCTORS
69	}
70	_gp = . + 0x8000;
71	.lit8 : {
72		*(.lit8)
73	}
74	.lit4 : {
75		*(.lit4)
76	}
77	/* We want the small data sections together, so single-instruction offsets
78	   can access them all, and initialized data all before uninitialized, so
79	   we can shorten the on-disk segment size.  */
80	.sdata : {
81		*(.sdata)
82	}
83	_edata =  .;			/* End of data section */
84
85	/* will be freed after init */
86	. = ALIGN(PAGE_SIZE);		/* Init code and data */
87	__init_begin = .;
88	INIT_TEXT_SECTION(PAGE_SIZE)
89	INIT_DATA_SECTION(16)
90
91	/* .exit.text is discarded at runtime, not link time, to deal with
92	 * references from .rodata
93	 */
94	.exit.text : {
95		EXIT_TEXT
96	}
97	.exit.data : {
98		EXIT_DATA
99	}
100
101	PERCPU(PAGE_SIZE)
102	. = ALIGN(PAGE_SIZE);
103	__init_end = .;
104	/* freed after init ends here */
105
106	BSS_SECTION(0, 0, 0)
107
108	_end = . ;
109
110	/* These mark the ABI of the kernel for debuggers.  */
111	.mdebug.abi32 : {
112		KEEP(*(.mdebug.abi32))
113	}
114	.mdebug.abi64 : {
115		KEEP(*(.mdebug.abi64))
116	}
117
118	/* This is the MIPS specific mdebug section.  */
119	.mdebug : {
120		*(.mdebug)
121	}
122
123	STABS_DEBUG
124	DWARF_DEBUG
125
126	/* These must appear regardless of  .  */
127	.gptab.sdata : {
128		*(.gptab.data)
129		*(.gptab.sdata)
130	}
131	.gptab.sbss : {
132		*(.gptab.bss)
133		*(.gptab.sbss)
134	}
135
136	/* Sections to be discarded */
137	DISCARDS
138	/DISCARD/ : {
139		/* ABI crap starts here */
140		*(.MIPS.options)
141		*(.options)
142		*(.pdr)
143		*(.reginfo)
144	}
145}
146