Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | |
Mike Rapoport | 65fddcf | 2020-06-08 21:32:42 -0700 | [diff] [blame] | 3 | #include <linux/pgtable.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <asm/cache.h> |
| 5 | #include <asm/ptrace.h> |
David Howells | 0500871 | 2018-01-02 15:12:01 +0000 | [diff] [blame] | 6 | #include <asm/thread_info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
Kees Cook | 441110a | 2019-10-29 14:13:30 -0700 | [diff] [blame] | 8 | #define EMITS_PT_NOTE |
Kees Cook | 9b30e70 | 2019-10-29 14:13:43 -0700 | [diff] [blame] | 9 | #define RO_EXCEPTION_TABLE_ALIGN 16 |
Kees Cook | 441110a | 2019-10-29 14:13:30 -0700 | [diff] [blame] | 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <asm-generic/vmlinux.lds.h> |
| 12 | |
| 13 | OUTPUT_FORMAT("elf64-ia64-little") |
| 14 | OUTPUT_ARCH(ia64) |
| 15 | ENTRY(phys_start) |
| 16 | jiffies = jiffies_64; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | PHDRS { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 19 | text PT_LOAD; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 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 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 26 | SECTIONS { |
| 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 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 38 | v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */ |
| 39 | phys_start = _start - LOAD_OFFSET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 41 | code : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 42 | } :text |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 43 | . = KERNEL_START; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 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 |
Chris Metcalf | 6727ad9 | 2016-10-07 17:02:55 -0700 | [diff] [blame] | 54 | CPUIDLE_TEXT |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 55 | LOCK_TEXT |
| 56 | KPROBES_TEXT |
Alexander Potapenko | 505a0ef | 2020-04-06 20:10:22 -0700 | [diff] [blame] | 57 | IRQENTRY_TEXT |
| 58 | SOFTIRQENTRY_TEXT |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 59 | *(.gnu.linkonce.t*) |
| 60 | } |
| 61 | |
| 62 | .text2 : AT(ADDR(.text2) - LOAD_OFFSET) { |
| 63 | *(.text2) |
| 64 | } |
| 65 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | #ifdef CONFIG_SMP |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 67 | .text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET) { |
| 68 | *(.text..lock) |
| 69 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | #endif |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 71 | _etext = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 73 | /* |
| 74 | * Read-only data |
| 75 | */ |
David Mosberger-Tang | 336cdba8 | 2007-08-09 11:53:15 -0600 | [diff] [blame] | 76 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 77 | /* MCA table */ |
| 78 | . = ALIGN(16); |
| 79 | __mca_table : AT(ADDR(__mca_table) - LOAD_OFFSET) { |
| 80 | __start___mca_table = .; |
| 81 | *(__mca_table) |
| 82 | __stop___mca_table = .; |
Russ Anderson | d89cfe7 | 2006-03-29 11:31:23 -0600 | [diff] [blame] | 83 | } |
| 84 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 85 | .data..patch.phys_stack_reg : AT(ADDR(.data..patch.phys_stack_reg) - LOAD_OFFSET) { |
| 86 | __start___phys_stack_reg_patchlist = .; |
| 87 | *(.data..patch.phys_stack_reg) |
| 88 | __end___phys_stack_reg_patchlist = .; |
Chen, Kenneth W | a0776ec | 2006-10-13 10:05:45 -0700 | [diff] [blame] | 89 | } |
| 90 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 91 | /* |
| 92 | * Global data |
| 93 | */ |
| 94 | _data = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 96 | /* Unwind info & table: */ |
| 97 | . = ALIGN(8); |
| 98 | .IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - LOAD_OFFSET) { |
| 99 | *(.IA_64.unwind_info*) |
| 100 | } |
| 101 | .IA_64.unwind : AT(ADDR(.IA_64.unwind) - LOAD_OFFSET) { |
| 102 | __start_unwind = .; |
| 103 | *(.IA_64.unwind*) |
| 104 | __end_unwind = .; |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 105 | } :text :unwind |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 106 | code_continues2 : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 107 | } :text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
Kees Cook | c823182 | 2019-10-29 14:13:33 -0700 | [diff] [blame] | 109 | RO_DATA(4096) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 111 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
Sergey Senozhatsky | 8e30788 | 2017-11-10 08:48:26 +0900 | [diff] [blame] | 112 | __start_opd = .; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 113 | *(.opd) |
Sergey Senozhatsky | 8e30788 | 2017-11-10 08:48:26 +0900 | [diff] [blame] | 114 | __end_opd = .; |
Chen, Kenneth W | 39e18de | 2006-03-12 09:20:27 -0800 | [diff] [blame] | 115 | } |
| 116 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 117 | /* |
| 118 | * Initialization code and data: |
| 119 | */ |
| 120 | . = ALIGN(PAGE_SIZE); |
| 121 | __init_begin = .; |
| 122 | |
| 123 | INIT_TEXT_SECTION(PAGE_SIZE) |
| 124 | INIT_DATA_SECTION(16) |
| 125 | |
| 126 | .data..patch.vtop : AT(ADDR(.data..patch.vtop) - LOAD_OFFSET) { |
| 127 | __start___vtop_patchlist = .; |
| 128 | *(.data..patch.vtop) |
| 129 | __end___vtop_patchlist = .; |
Tony Luck | 4dcc29e | 2008-05-27 13:23:16 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 132 | .data..patch.rse : AT(ADDR(.data..patch.rse) - LOAD_OFFSET) { |
| 133 | __start___rse_patchlist = .; |
| 134 | *(.data..patch.rse) |
| 135 | __end___rse_patchlist = .; |
| 136 | } |
| 137 | |
| 138 | .data..patch.mckinley_e9 : AT(ADDR(.data..patch.mckinley_e9) - LOAD_OFFSET) { |
| 139 | __start___mckinley_e9_bundles = .; |
| 140 | *(.data..patch.mckinley_e9) |
| 141 | __end___mckinley_e9_bundles = .; |
Chen, Kenneth W | 39e18de | 2006-03-12 09:20:27 -0800 | [diff] [blame] | 142 | } |
| 143 | |
Tejun Heo | 3688647 | 2009-10-02 13:28:56 +0900 | [diff] [blame] | 144 | #ifdef CONFIG_SMP |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 145 | . = ALIGN(PERCPU_PAGE_SIZE); |
| 146 | __cpu0_per_cpu = .; |
| 147 | . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ |
Tejun Heo | 3688647 | 2009-10-02 13:28:56 +0900 | [diff] [blame] | 148 | #endif |
| 149 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 150 | . = ALIGN(PAGE_SIZE); |
| 151 | __init_end = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 153 | .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) { |
| 154 | PAGE_ALIGNED_DATA(PAGE_SIZE) |
| 155 | . = ALIGN(PAGE_SIZE); |
| 156 | __start_gate_section = .; |
| 157 | *(.data..gate) |
| 158 | __stop_gate_section = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | } |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 160 | /* |
| 161 | * make sure the gate page doesn't expose |
| 162 | * kernel data |
| 163 | */ |
| 164 | . = ALIGN(PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 166 | /* Per-cpu data: */ |
| 167 | . = ALIGN(PERCPU_PAGE_SIZE); |
Tejun Heo | 19df0c2 | 2011-01-25 14:26:50 +0100 | [diff] [blame] | 168 | PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu) |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 169 | __phys_per_cpu_start = __per_cpu_load; |
| 170 | /* |
| 171 | * ensure percpu data fits |
| 172 | * into percpu page size |
| 173 | */ |
| 174 | . = __phys_per_cpu_start + PERCPU_PAGE_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 176 | data : { |
| 177 | } :data |
| 178 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
Tony Luck | 30f7276 | 2011-05-20 10:38:53 -0700 | [diff] [blame] | 179 | _sdata = .; |
Nelson Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 180 | INIT_TASK_DATA(PAGE_SIZE) |
| 181 | CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES) |
| 182 | READ_MOSTLY_DATA(SMP_CACHE_BYTES) |
Sam Ravnborg | ca96725 | 2007-05-17 13:38:44 +0200 | [diff] [blame] | 183 | DATA_DATA |
| 184 | *(.data1) |
| 185 | *(.gnu.linkonce.d*) |
| 186 | CONSTRUCTORS |
| 187 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | |
Peter Zijlstra | b5effd3 | 2017-03-30 17:49:27 +0200 | [diff] [blame] | 189 | BUG_TABLE |
| 190 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 191 | . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */ |
| 192 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
| 193 | *(.got.plt) |
| 194 | *(.got) |
| 195 | } |
| 196 | __gp = ADDR(.got) + 0x200000; |
Nelson Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 197 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 198 | /* |
| 199 | * We want the small data sections together, |
| 200 | * so single-instruction offsets can access |
| 201 | * them all, and initialized data all before |
| 202 | * uninitialized, so we can shorten the |
| 203 | * on-disk segment size. |
| 204 | */ |
| 205 | .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) { |
| 206 | *(.sdata) |
| 207 | *(.sdata1) |
| 208 | *(.srdata) |
| 209 | } |
| 210 | _edata = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 212 | BSS_SECTION(0, 0, 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 214 | _end = .; |
Nelson Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 215 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 216 | code : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 217 | } :text |
Tejun Heo | 023bf6f | 2009-07-09 11:27:40 +0900 | [diff] [blame] | 218 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 219 | STABS_DEBUG |
| 220 | DWARF_DEBUG |
Kees Cook | c604abc | 2020-08-21 12:42:45 -0700 | [diff] [blame] | 221 | ELF_DETAILS |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 222 | |
| 223 | /* Default discards */ |
| 224 | DISCARDS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | } |