blob: 11d5115bc44d2378ba411fa65d5582475b3f92bd [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
3#include <asm/cache.h>
4#include <asm/ptrace.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <asm/pgtable.h>
David Howells05008712018-01-02 15:12:01 +00006#include <asm/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
Kees Cook441110a2019-10-29 14:13:30 -07008#define EMITS_PT_NOTE
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm-generic/vmlinux.lds.h>
11
12OUTPUT_FORMAT("elf64-ia64-little")
13OUTPUT_ARCH(ia64)
14ENTRY(phys_start)
15jiffies = jiffies_64;
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017PHDRS {
Kees Cook430c6b22019-10-29 14:13:27 -070018 text PT_LOAD;
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020019 percpu PT_LOAD;
20 data PT_LOAD;
21 note PT_NOTE;
22 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */
Linus Torvalds1da177e2005-04-16 15:20:36 -070023}
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020025SECTIONS {
26 /*
27 * unwind exit sections must be discarded before
28 * the rest of the sections get included.
29 */
30 /DISCARD/ : {
31 *(.IA_64.unwind.exit.text)
32 *(.IA_64.unwind_info.exit.text)
33 *(.comment)
34 *(.note)
35 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020037 v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */
38 phys_start = _start - LOAD_OFFSET;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020040 code : {
Kees Cook430c6b22019-10-29 14:13:27 -070041 } :text
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020042 . = KERNEL_START;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020044 _text = .;
45 _stext = .;
46
47 .text : AT(ADDR(.text) - LOAD_OFFSET) {
48 __start_ivt_text = .;
49 *(.text..ivt)
50 __end_ivt_text = .;
51 TEXT_TEXT
52 SCHED_TEXT
Chris Metcalf6727ad92016-10-07 17:02:55 -070053 CPUIDLE_TEXT
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020054 LOCK_TEXT
55 KPROBES_TEXT
56 *(.gnu.linkonce.t*)
57 }
58
59 .text2 : AT(ADDR(.text2) - LOAD_OFFSET) {
60 *(.text2)
61 }
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#ifdef CONFIG_SMP
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020064 .text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET) {
65 *(.text..lock)
66 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070067#endif
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020068 _etext = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020070 /*
71 * Read-only data
72 */
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020073 EXCEPTION_TABLE(16)
David Mosberger-Tang336cdba82007-08-09 11:53:15 -060074
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020075 /* MCA table */
76 . = ALIGN(16);
77 __mca_table : AT(ADDR(__mca_table) - LOAD_OFFSET) {
78 __start___mca_table = .;
79 *(__mca_table)
80 __stop___mca_table = .;
Russ Andersond89cfe72006-03-29 11:31:23 -060081 }
82
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020083 .data..patch.phys_stack_reg : AT(ADDR(.data..patch.phys_stack_reg) - LOAD_OFFSET) {
84 __start___phys_stack_reg_patchlist = .;
85 *(.data..patch.phys_stack_reg)
86 __end___phys_stack_reg_patchlist = .;
Chen, Kenneth Wa0776ec2006-10-13 10:05:45 -070087 }
88
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020089 /*
90 * Global data
91 */
92 _data = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Sam Ravnborg7b313fd2010-06-19 17:19:25 +020094 /* Unwind info & table: */
95 . = ALIGN(8);
96 .IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - LOAD_OFFSET) {
97 *(.IA_64.unwind_info*)
98 }
99 .IA_64.unwind : AT(ADDR(.IA_64.unwind) - LOAD_OFFSET) {
100 __start_unwind = .;
101 *(.IA_64.unwind*)
102 __end_unwind = .;
Kees Cook430c6b22019-10-29 14:13:27 -0700103 } :text :unwind
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200104 code_continues2 : {
Kees Cook430c6b22019-10-29 14:13:27 -0700105 } :text
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
Kees Cookc8231822019-10-29 14:13:33 -0700107 RO_DATA(4096)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200109 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
Sergey Senozhatsky8e307882017-11-10 08:48:26 +0900110 __start_opd = .;
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200111 *(.opd)
Sergey Senozhatsky8e307882017-11-10 08:48:26 +0900112 __end_opd = .;
Chen, Kenneth W39e18de2006-03-12 09:20:27 -0800113 }
114
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200115 /*
116 * Initialization code and data:
117 */
118 . = ALIGN(PAGE_SIZE);
119 __init_begin = .;
120
121 INIT_TEXT_SECTION(PAGE_SIZE)
122 INIT_DATA_SECTION(16)
123
124 .data..patch.vtop : AT(ADDR(.data..patch.vtop) - LOAD_OFFSET) {
125 __start___vtop_patchlist = .;
126 *(.data..patch.vtop)
127 __end___vtop_patchlist = .;
Tony Luck4dcc29e2008-05-27 13:23:16 -0700128 }
129
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200130 .data..patch.rse : AT(ADDR(.data..patch.rse) - LOAD_OFFSET) {
131 __start___rse_patchlist = .;
132 *(.data..patch.rse)
133 __end___rse_patchlist = .;
134 }
135
136 .data..patch.mckinley_e9 : AT(ADDR(.data..patch.mckinley_e9) - LOAD_OFFSET) {
137 __start___mckinley_e9_bundles = .;
138 *(.data..patch.mckinley_e9)
139 __end___mckinley_e9_bundles = .;
Chen, Kenneth W39e18de2006-03-12 09:20:27 -0800140 }
141
Tejun Heo36886472009-10-02 13:28:56 +0900142#ifdef CONFIG_SMP
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200143 . = ALIGN(PERCPU_PAGE_SIZE);
144 __cpu0_per_cpu = .;
145 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
Tejun Heo36886472009-10-02 13:28:56 +0900146#endif
147
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200148 . = ALIGN(PAGE_SIZE);
149 __init_end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200151 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
152 PAGE_ALIGNED_DATA(PAGE_SIZE)
153 . = ALIGN(PAGE_SIZE);
154 __start_gate_section = .;
155 *(.data..gate)
156 __stop_gate_section = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 }
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200158 /*
159 * make sure the gate page doesn't expose
160 * kernel data
161 */
162 . = ALIGN(PAGE_SIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200164 /* Per-cpu data: */
165 . = ALIGN(PERCPU_PAGE_SIZE);
Tejun Heo19df0c22011-01-25 14:26:50 +0100166 PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu)
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200167 __phys_per_cpu_start = __per_cpu_load;
168 /*
169 * ensure percpu data fits
170 * into percpu page size
171 */
172 . = __phys_per_cpu_start + PERCPU_PAGE_SIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200174 data : {
175 } :data
176 .data : AT(ADDR(.data) - LOAD_OFFSET) {
Tony Luck30f72762011-05-20 10:38:53 -0700177 _sdata = .;
Nelson Elhage6ae86352009-07-31 16:57:53 -0400178 INIT_TASK_DATA(PAGE_SIZE)
179 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
180 READ_MOSTLY_DATA(SMP_CACHE_BYTES)
Sam Ravnborgca967252007-05-17 13:38:44 +0200181 DATA_DATA
182 *(.data1)
183 *(.gnu.linkonce.d*)
184 CONSTRUCTORS
185 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
Peter Zijlstrab5effd32017-03-30 17:49:27 +0200187 BUG_TABLE
188
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200189 . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */
190 .got : AT(ADDR(.got) - LOAD_OFFSET) {
191 *(.got.plt)
192 *(.got)
193 }
194 __gp = ADDR(.got) + 0x200000;
Nelson Elhage6ae86352009-07-31 16:57:53 -0400195
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200196 /*
197 * We want the small data sections together,
198 * so single-instruction offsets can access
199 * them all, and initialized data all before
200 * uninitialized, so we can shorten the
201 * on-disk segment size.
202 */
203 .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) {
204 *(.sdata)
205 *(.sdata1)
206 *(.srdata)
207 }
208 _edata = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200210 BSS_SECTION(0, 0, 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200212 _end = .;
Nelson Elhage6ae86352009-07-31 16:57:53 -0400213
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200214 code : {
Kees Cook430c6b22019-10-29 14:13:27 -0700215 } :text
Tejun Heo023bf6f2009-07-09 11:27:40 +0900216
Sam Ravnborg7b313fd2010-06-19 17:19:25 +0200217 STABS_DEBUG
218 DWARF_DEBUG
219
220 /* Default discards */
221 DISCARDS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222}