Merge tag 'pm-6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux-block.git] / arch / mips / kernel / vmlinux.lds.S
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
dbee90b7 2#include <asm/asm-offsets.h>
7b1c0d26 3#include <asm/thread_info.h>
485172b3 4
bef9ae3d
RB
5#define PAGE_SIZE _PAGE_SIZE
6
485172b3
DD
7/*
8 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
9 * ensure that it has .bss alignment (64K).
10 */
11#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
12
441110a5
KC
13/* Cavium Octeon should not have a separate PT_NOTE Program Header. */
14#ifndef CONFIG_CAVIUM_OCTEON_SOC
15#define EMITS_PT_NOTE
16#endif
17
6dcbd0a6
JY
18#define RUNTIME_DISCARD_EXIT
19
1da177e4
LT
20#include <asm-generic/vmlinux.lds.h>
21
41c594ab 22#undef mips
1da177e4
LT
23#define mips mips
24OUTPUT_ARCH(mips)
25ENTRY(kernel_entry)
603bb99c
RB
26PHDRS {
27 text PT_LOAD FLAGS(7); /* RWX */
3bfb7224 28#ifndef CONFIG_CAVIUM_OCTEON_SOC
603bb99c 29 note PT_NOTE FLAGS(4); /* R__ */
3bfb7224 30#endif /* CAVIUM_OCTEON_SOC */
603bb99c 31}
51b563fc 32
d71789b6
ML
33#ifdef CONFIG_32BIT
34 #ifdef CONFIG_CPU_LITTLE_ENDIAN
70342287 35 jiffies = jiffies_64;
d71789b6 36 #else
70342287 37 jiffies = jiffies_64 + 4;
d71789b6
ML
38 #endif
39#else
70342287 40 jiffies = jiffies_64;
d71789b6 41#endif
0f5c9064 42
1da177e4
LT
43SECTIONS
44{
45#ifdef CONFIG_BOOT_ELF64
0f5c9064
SR
46 /* Read-only sections, merged into text segment: */
47 /* . = 0xc000000000000000; */
1da177e4 48
0f5c9064
SR
49 /* This is the value for an Origin kernel, taken from an IRIX kernel. */
50 /* . = 0xc00000000001c000; */
1da177e4 51
0f5c9064
SR
52 /* Set the vaddr for the text segment to a value
53 * >= 0xa800 0000 0001 9000 if no symmon is going to configured
54 * >= 0xa800 0000 0030 0000 otherwise
55 */
1da177e4 56
0f5c9064
SR
57 /* . = 0xa800000000300000; */
58 . = 0xffffffff80300000;
1da177e4 59#endif
ff487d41 60 . = LINKER_LOAD_ADDRESS;
0f5c9064
SR
61 /* read-only */
62 _text = .; /* Text and read-only data */
63 .text : {
52892ed6 64 HEAD_TEXT
0f5c9064
SR
65 TEXT_TEXT
66 SCHED_TEXT
67 LOCK_TEXT
f70fd1b5 68 KPROBES_TEXT
8f99a162 69 IRQENTRY_TEXT
be7635e7 70 SOFTIRQENTRY_TEXT
0f5c9064
SR
71 *(.fixup)
72 *(.gnu.warning)
795b3a36
AL
73 . = ALIGN(16);
74 *(.got) /* Global offset table */
603bb99c 75 } :text = 0
0f5c9064
SR
76 _etext = .; /* End of text section */
77
6eb10bc9 78 EXCEPTION_TABLE(16)
0f5c9064
SR
79
80 /* Exception table for data bus errors */
81 __dbe_table : {
82 __start___dbe_table = .;
c0436b50 83 KEEP(*(__dbe_table))
0f5c9064
SR
84 __stop___dbe_table = .;
85 }
603bb99c 86
a2d063ac 87 _sdata = .; /* Start of data section */
c8231825 88 RO_DATA(4096)
0f5c9064
SR
89
90 /* writeable */
91 .data : { /* Data */
16be2435 92 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
0f5c9064 93
7b1c0d26 94 INIT_TASK_DATA(THREAD_SIZE)
6eb10bc9 95 NOSAVE_DATA
8ac7c87a 96 PAGE_ALIGNED_DATA(PAGE_SIZE)
6eb10bc9 97 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
f8bec75a 98 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
16be2435
FBH
99 DATA_DATA
100 CONSTRUCTORS
0f5c9064 101 }
b5effd38 102 BUG_TABLE
0f5c9064
SR
103 _gp = . + 0x8000;
104 .lit8 : {
105 *(.lit8)
106 }
107 .lit4 : {
108 *(.lit4)
109 }
110 /* We want the small data sections together, so single-instruction offsets
111 can access them all, and initialized data all before uninitialized, so
112 we can shorten the on-disk segment size. */
113 .sdata : {
114 *(.sdata)
115 }
0f5c9064
SR
116 _edata = .; /* End of data section */
117
118 /* will be freed after init */
a0b54e25 119 . = ALIGN(PAGE_SIZE); /* Init code and data */
0f5c9064 120 __init_begin = .;
6eb10bc9
NE
121 INIT_TEXT_SECTION(PAGE_SIZE)
122 INIT_DATA_SECTION(16)
0f5c9064 123
487d70d0
GJ
124 . = ALIGN(4);
125 .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
126 __mips_machines_start = .;
c0436b50 127 KEEP(*(.mips.machines.init))
487d70d0
GJ
128 __mips_machines_end = .;
129 }
130
0f5c9064
SR
131 /* .exit.text is discarded at runtime, not link time, to deal with
132 * references from .rodata
133 */
134 .exit.text : {
01ba2bdc 135 EXIT_TEXT
0f5c9064
SR
136 }
137 .exit.data : {
01ba2bdc 138 EXIT_DATA
0f5c9064 139 }
1da8f179 140#ifdef CONFIG_SMP
0415b00d 141 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
1da8f179 142#endif
069fd766 143
008c3cbd
AL
144 .rel.dyn : ALIGN(8) {
145 *(.rel)
146 *(.rel*)
147 }
148
3f0a53bc 149#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
7a05293a 150 STRUCT_ALIGN();
3f0a53bc
YC
151 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
152 *(.appended_dtb)
153 KEEP(*(.appended_dtb))
154 }
155#endif
156
069fd766
MR
157#ifdef CONFIG_RELOCATABLE
158 . = ALIGN(4);
159
160 .data.reloc : {
161 _relocation_start = .;
162 /*
163 * Space for relocation table
164 * This needs to be filled so that the
165 * relocs tool can overwrite the content.
166 * An invalid value is left at the start of the
167 * section to abort relocation if the table
168 * has not been filled in.
169 */
170 LONG(0xFFFFFFFF);
171 FILL(0);
172 . += CONFIG_RELOCATION_TABLE_SIZE - 4;
173 _relocation_end = .;
174 }
175#endif
176
1da8f179 177#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
6654111c
BM
178 .fill : {
179 FILL(0);
180 BYTE(0);
3f6c515d 181 STRUCT_ALIGN();
6654111c 182 }
1da8f179
JG
183 __appended_dtb = .;
184 /* leave space for appended DTB */
185 . += 0x100000;
186#endif
485172b3
DD
187 /*
188 * Align to 64K in attempt to eliminate holes before the
189 * .bss..swapper_pg_dir section at the start of .bss. This
190 * also satisfies PAGE_SIZE alignment as the largest page size
191 * allowed is 64K.
192 */
193 . = ALIGN(0x10000);
0f5c9064
SR
194 __init_end = .;
195 /* freed after init ends here */
196
485172b3
DD
197 /*
198 * Force .bss to 64K alignment so that .bss..swapper_pg_dir
70342287 199 * gets that alignment. .sbss should be empty, so there will be
485172b3 200 * no holes after __init_end. */
3f00f4d8 201 BSS_SECTION(0, 0x10000, 8)
0f5c9064
SR
202
203 _end = . ;
204
0f5c9064
SR
205 /* These mark the ABI of the kernel for debuggers. */
206 .mdebug.abi32 : {
207 KEEP(*(.mdebug.abi32))
208 }
209 .mdebug.abi64 : {
210 KEEP(*(.mdebug.abi64))
211 }
212
213 /* This is the MIPS specific mdebug section. */
214 .mdebug : {
215 *(.mdebug)
216 }
217
218 STABS_DEBUG
219 DWARF_DEBUG
c604abc3 220 ELF_DETAILS
0f5c9064
SR
221
222 /* These must appear regardless of . */
223 .gptab.sdata : {
224 *(.gptab.data)
225 *(.gptab.sdata)
226 }
227 .gptab.sbss : {
228 *(.gptab.bss)
229 *(.gptab.sbss)
230 }
023bf6f1
TH
231
232 /* Sections to be discarded */
233 DISCARDS
234 /DISCARD/ : {
235 /* ABI crap starts here */
61379878 236 *(.MIPS.abiflags)
023bf6f1 237 *(.MIPS.options)
5629d418 238 *(.gnu.attributes)
023bf6f1
TH
239 *(.options)
240 *(.pdr)
241 *(.reginfo)
242 }
1da177e4 243}