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 | |
| 3 | #include <asm/cache.h> |
| 4 | #include <asm/ptrace.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <asm/pgtable.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 |
| 9 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <asm-generic/vmlinux.lds.h> |
| 11 | |
| 12 | OUTPUT_FORMAT("elf64-ia64-little") |
| 13 | OUTPUT_ARCH(ia64) |
| 14 | ENTRY(phys_start) |
| 15 | jiffies = jiffies_64; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | PHDRS { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 18 | text PT_LOAD; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 19 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 25 | SECTIONS { |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 37 | v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */ |
| 38 | phys_start = _start - LOAD_OFFSET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 40 | code : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 41 | } :text |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 42 | . = KERNEL_START; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 44 | _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 Metcalf | 6727ad9 | 2016-10-07 17:02:55 -0700 | [diff] [blame] | 53 | CPUIDLE_TEXT |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 54 | LOCK_TEXT |
| 55 | KPROBES_TEXT |
| 56 | *(.gnu.linkonce.t*) |
| 57 | } |
| 58 | |
| 59 | .text2 : AT(ADDR(.text2) - LOAD_OFFSET) { |
| 60 | *(.text2) |
| 61 | } |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #ifdef CONFIG_SMP |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 64 | .text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET) { |
| 65 | *(.text..lock) |
| 66 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #endif |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 68 | _etext = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 70 | /* |
| 71 | * Read-only data |
| 72 | */ |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 73 | EXCEPTION_TABLE(16) |
David Mosberger-Tang | 336cdba8 | 2007-08-09 11:53:15 -0600 | [diff] [blame] | 74 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 75 | /* 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 Anderson | d89cfe7 | 2006-03-29 11:31:23 -0600 | [diff] [blame] | 81 | } |
| 82 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 83 | .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 W | a0776ec | 2006-10-13 10:05:45 -0700 | [diff] [blame] | 87 | } |
| 88 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 89 | /* |
| 90 | * Global data |
| 91 | */ |
| 92 | _data = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 94 | /* 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 Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 103 | } :text :unwind |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 104 | code_continues2 : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 105 | } :text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
Kees Cook | c823182 | 2019-10-29 14:13:33 -0700 | [diff] [blame^] | 107 | RO_DATA(4096) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 109 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
Sergey Senozhatsky | 8e30788 | 2017-11-10 08:48:26 +0900 | [diff] [blame] | 110 | __start_opd = .; |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 111 | *(.opd) |
Sergey Senozhatsky | 8e30788 | 2017-11-10 08:48:26 +0900 | [diff] [blame] | 112 | __end_opd = .; |
Chen, Kenneth W | 39e18de | 2006-03-12 09:20:27 -0800 | [diff] [blame] | 113 | } |
| 114 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 115 | /* |
| 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 Luck | 4dcc29e | 2008-05-27 13:23:16 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 130 | .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 W | 39e18de | 2006-03-12 09:20:27 -0800 | [diff] [blame] | 140 | } |
| 141 | |
Tejun Heo | 3688647 | 2009-10-02 13:28:56 +0900 | [diff] [blame] | 142 | #ifdef CONFIG_SMP |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 143 | . = ALIGN(PERCPU_PAGE_SIZE); |
| 144 | __cpu0_per_cpu = .; |
| 145 | . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ |
Tejun Heo | 3688647 | 2009-10-02 13:28:56 +0900 | [diff] [blame] | 146 | #endif |
| 147 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 148 | . = ALIGN(PAGE_SIZE); |
| 149 | __init_end = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 151 | .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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | } |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 158 | /* |
| 159 | * make sure the gate page doesn't expose |
| 160 | * kernel data |
| 161 | */ |
| 162 | . = ALIGN(PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 164 | /* Per-cpu data: */ |
| 165 | . = ALIGN(PERCPU_PAGE_SIZE); |
Tejun Heo | 19df0c2 | 2011-01-25 14:26:50 +0100 | [diff] [blame] | 166 | PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu) |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 167 | __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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 174 | data : { |
| 175 | } :data |
| 176 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
Tony Luck | 30f7276 | 2011-05-20 10:38:53 -0700 | [diff] [blame] | 177 | _sdata = .; |
Nelson Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 178 | INIT_TASK_DATA(PAGE_SIZE) |
| 179 | CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES) |
| 180 | READ_MOSTLY_DATA(SMP_CACHE_BYTES) |
Sam Ravnborg | ca96725 | 2007-05-17 13:38:44 +0200 | [diff] [blame] | 181 | DATA_DATA |
| 182 | *(.data1) |
| 183 | *(.gnu.linkonce.d*) |
| 184 | CONSTRUCTORS |
| 185 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | |
Peter Zijlstra | b5effd3 | 2017-03-30 17:49:27 +0200 | [diff] [blame] | 187 | BUG_TABLE |
| 188 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 189 | . = 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 Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 195 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 196 | /* |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 210 | BSS_SECTION(0, 0, 0) |
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 | _end = .; |
Nelson Elhage | 6ae8635 | 2009-07-31 16:57:53 -0400 | [diff] [blame] | 213 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 214 | code : { |
Kees Cook | 430c6b2 | 2019-10-29 14:13:27 -0700 | [diff] [blame] | 215 | } :text |
Tejun Heo | 023bf6f | 2009-07-09 11:27:40 +0900 | [diff] [blame] | 216 | |
Sam Ravnborg | 7b313fd | 2010-06-19 17:19:25 +0200 | [diff] [blame] | 217 | STABS_DEBUG |
| 218 | DWARF_DEBUG |
| 219 | |
| 220 | /* Default discards */ |
| 221 | DISCARDS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | } |