1/* SPDX-License-Identifier: GPL-2.0 */
2
3#include <linux/pgtable.h>
4#include <asm/cache.h>
5#include <asm/ptrace.h>
6#include <asm/thread_info.h>
7
8#define EMITS_PT_NOTE
9#define RO_EXCEPTION_TABLE_ALIGN	16
10
11#include <asm-generic/vmlinux.lds.h>
12
13OUTPUT_FORMAT("elf64-ia64-little")
14OUTPUT_ARCH(ia64)
15ENTRY(phys_start)
16jiffies = jiffies_64;
17
18PHDRS {
19	text   PT_LOAD;
20	percpu PT_LOAD;
21	data   PT_LOAD;
22	note   PT_NOTE;
23	unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */
24}
25
26SECTIONS {
27	/*
28	 * unwind exit sections must be discarded before
29	 * the rest of the sections get included.
30	 */
31	/DISCARD/ : {
32		*(.IA_64.unwind.exit.text)
33		*(.IA_64.unwind_info.exit.text)
34		*(.comment)
35		*(.note)
36	}
37
38	v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */
39	phys_start = _start - LOAD_OFFSET;
40
41	code : {
42	} :text
43	. = KERNEL_START;
44
45	_text = .;
46	_stext = .;
47
48	.text : AT(ADDR(.text) - LOAD_OFFSET) {
49		__start_ivt_text = .;
50		*(.text..ivt)
51		__end_ivt_text = .;
52		TEXT_TEXT
53		SCHED_TEXT
54		LOCK_TEXT
55		KPROBES_TEXT
56		IRQENTRY_TEXT
57		SOFTIRQENTRY_TEXT
58		*(.gnu.linkonce.t*)
59	}
60
61	.text2 : AT(ADDR(.text2) - LOAD_OFFSET)	{
62		*(.text2)
63	}
64
65#ifdef CONFIG_SMP
66	.text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET) {
67		*(.text..lock)
68	}
69#endif
70	_etext = .;
71
72	/*
73	 * Read-only data
74	 */
75
76	/* MCA table */
77	. = ALIGN(16);
78	__mca_table : AT(ADDR(__mca_table) - LOAD_OFFSET) {
79		__start___mca_table = .;
80		*(__mca_table)
81		__stop___mca_table = .;
82	}
83
84	.data..patch.phys_stack_reg : AT(ADDR(.data..patch.phys_stack_reg) - LOAD_OFFSET) {
85		__start___phys_stack_reg_patchlist = .;
86		*(.data..patch.phys_stack_reg)
87		__end___phys_stack_reg_patchlist = .;
88	}
89
90	/*
91	 * Global data
92	 */
93	_data = .;
94
95	/* Unwind info & table: */
96	. = ALIGN(8);
97	.IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - LOAD_OFFSET) {
98		*(.IA_64.unwind_info*)
99	}
100	.IA_64.unwind : AT(ADDR(.IA_64.unwind) - LOAD_OFFSET) {
101		__start_unwind = .;
102		*(.IA_64.unwind*)
103		__end_unwind = .;
104	} :text :unwind
105	code_continues2 : {
106	} :text
107
108	RO_DATA(4096)
109
110	.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
111		__start_opd = .;
112		*(.opd)
113		__end_opd = .;
114	}
115
116	/*
117	 * Initialization code and data:
118	 */
119	. = ALIGN(PAGE_SIZE);
120	__init_begin = .;
121
122	INIT_TEXT_SECTION(PAGE_SIZE)
123	INIT_DATA_SECTION(16)
124
125	.data..patch.vtop : AT(ADDR(.data..patch.vtop) - LOAD_OFFSET) {
126		__start___vtop_patchlist = .;
127		*(.data..patch.vtop)
128		__end___vtop_patchlist = .;
129	}
130
131	.data..patch.rse : AT(ADDR(.data..patch.rse) - LOAD_OFFSET) {
132		__start___rse_patchlist = .;
133		*(.data..patch.rse)
134		__end___rse_patchlist = .;
135	}
136
137	.data..patch.mckinley_e9 : AT(ADDR(.data..patch.mckinley_e9) - LOAD_OFFSET) {
138		__start___mckinley_e9_bundles = .;
139		*(.data..patch.mckinley_e9)
140		__end___mckinley_e9_bundles = .;
141	}
142
143#ifdef	CONFIG_SMP
144	. = ALIGN(PERCPU_PAGE_SIZE);
145	__cpu0_per_cpu = .;
146	. = . + PERCPU_PAGE_SIZE;   /* cpu0 per-cpu space */
147#endif
148
149	. = ALIGN(PAGE_SIZE);
150	__init_end = .;
151
152	.data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
153		PAGE_ALIGNED_DATA(PAGE_SIZE)
154		. = ALIGN(PAGE_SIZE);
155		__start_gate_section = .;
156		*(.data..gate)
157		__stop_gate_section = .;
158	}
159	/*
160	 * make sure the gate page doesn't expose
161	 * kernel data
162	 */
163	. = ALIGN(PAGE_SIZE);
164
165	/* Per-cpu data: */
166	. = ALIGN(PERCPU_PAGE_SIZE);
167	PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu)
168	__phys_per_cpu_start = __per_cpu_load;
169	/*
170	 * ensure percpu data fits
171	 * into percpu page size
172	 */
173	. = __phys_per_cpu_start + PERCPU_PAGE_SIZE;
174
175	data : {
176	} :data
177	.data : AT(ADDR(.data) - LOAD_OFFSET) {
178		_sdata  =  .;
179		INIT_TASK_DATA(PAGE_SIZE)
180		CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
181		READ_MOSTLY_DATA(SMP_CACHE_BYTES)
182		DATA_DATA
183		*(.data1)
184		*(.gnu.linkonce.d*)
185		CONSTRUCTORS
186	}
187
188	BUG_TABLE
189
190	. = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
191	.got : AT(ADDR(.got) - LOAD_OFFSET) {
192		*(.got.plt)
193		*(.got)
194	}
195	__gp = ADDR(.got) + 0x200000;
196
197	/*
198	 * We want the small data sections together,
199	 * so single-instruction offsets can access
200	 * them all, and initialized data all before
201	 * uninitialized, so we can shorten the
202	 * on-disk segment size.
203	 */
204	.sdata : AT(ADDR(.sdata) - LOAD_OFFSET) {
205		*(.sdata)
206		*(.sdata1)
207		*(.srdata)
208	}
209	_edata  =  .;
210
211	BSS_SECTION(0, 0, 0)
212
213	_end = .;
214
215	code : {
216	} :text
217
218	STABS_DEBUG
219	DWARF_DEBUG
220	ELF_DETAILS
221
222	/* Default discards */
223	DISCARDS
224}
225