Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ld script to make s390 Linux kernel |
| 2 | * Written by Martin Schwidefsky (schwidefsky@de.ibm.com) |
| 3 | */ |
| 4 | |
Heiko Carstens | 0778dc3 | 2008-11-27 11:05:58 +0100 | [diff] [blame] | 5 | #include <asm/thread_info.h> |
Sam Ravnborg | 52480ee | 2007-10-12 16:11:50 +0200 | [diff] [blame] | 6 | #include <asm/page.h> |
Heiko Carstens | 0ccb32c | 2016-05-28 10:03:55 +0200 | [diff] [blame] | 7 | |
| 8 | /* |
| 9 | * Put .bss..swapper_pg_dir as the first thing in .bss. This will |
| 10 | * make sure it has 16k alignment. |
| 11 | */ |
| 12 | #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) |
| 13 | |
Heiko Carstens | d07a980 | 2016-06-07 10:12:55 +0200 | [diff] [blame] | 14 | /* Handle ro_after_init data on our own. */ |
| 15 | #define RO_AFTER_INIT_DATA |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <asm-generic/vmlinux.lds.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") |
| 20 | OUTPUT_ARCH(s390:64-bit) |
Christian Borntraeger | e0a15d5 | 2012-01-18 18:03:39 +0100 | [diff] [blame] | 21 | ENTRY(startup) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | jiffies = jiffies_64; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Martin Schwidefsky | ea29ee1 | 2008-01-26 14:11:21 +0100 | [diff] [blame] | 24 | PHDRS { |
| 25 | text PT_LOAD FLAGS(5); /* R_E */ |
| 26 | data PT_LOAD FLAGS(7); /* RWE */ |
| 27 | note PT_NOTE FLAGS(0); /* ___ */ |
| 28 | } |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | SECTIONS |
| 31 | { |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 32 | . = 0x00000000; |
| 33 | .text : { |
Heiko Carstens | 26c18cb | 2017-05-04 09:42:22 +0200 | [diff] [blame] | 34 | /* Text and read-only data */ |
Tim Abbott | 2133bb8 | 2009-04-25 22:11:06 -0400 | [diff] [blame] | 35 | HEAD_TEXT |
Heiko Carstens | 26c18cb | 2017-05-04 09:42:22 +0200 | [diff] [blame] | 36 | /* |
| 37 | * E.g. perf doesn't like symbols starting at address zero, |
| 38 | * therefore skip the initial PSW and channel program located |
| 39 | * at address zero and let _text start at 0x200. |
| 40 | */ |
| 41 | _text = 0x200; |
Tim Abbott | 2133bb8 | 2009-04-25 22:11:06 -0400 | [diff] [blame] | 42 | TEXT_TEXT |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 43 | SCHED_TEXT |
Chris Metcalf | 6727ad9 | 2016-10-07 17:02:55 -0700 | [diff] [blame] | 44 | CPUIDLE_TEXT |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 45 | LOCK_TEXT |
| 46 | KPROBES_TEXT |
Heiko Carstens | 88dbd20 | 2009-06-12 10:26:46 +0200 | [diff] [blame] | 47 | IRQENTRY_TEXT |
Alexander Potapenko | be7635e | 2016-03-25 14:22:05 -0700 | [diff] [blame] | 48 | SOFTIRQENTRY_TEXT |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 49 | *(.fixup) |
| 50 | *(.gnu.warning) |
Heiko Carstens | a817a61 | 2008-02-05 16:50:38 +0100 | [diff] [blame] | 51 | } :text = 0x0700 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 53 | _etext = .; /* End of text section */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Martin Schwidefsky | ea29ee1 | 2008-01-26 14:11:21 +0100 | [diff] [blame] | 55 | NOTES :text :note |
Martin Schwidefsky | ea29ee1 | 2008-01-26 14:11:21 +0100 | [diff] [blame] | 56 | |
Martin Schwidefsky | 7a2512b | 2011-11-14 11:19:02 +0100 | [diff] [blame] | 57 | .dummy : { *(.dummy) } :data |
| 58 | |
Heiko Carstens | 56280b1 | 2012-07-24 16:32:39 +0200 | [diff] [blame] | 59 | RO_DATA_SECTION(PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
| 61 | #ifdef CONFIG_SHARED_KERNEL |
Sam Ravnborg | 52480ee | 2007-10-12 16:11:50 +0200 | [diff] [blame] | 62 | . = ALIGN(0x100000); /* VM shared segments are 1MB aligned */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #endif |
| 64 | |
Sam Ravnborg | 52480ee | 2007-10-12 16:11:50 +0200 | [diff] [blame] | 65 | . = ALIGN(PAGE_SIZE); |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 66 | _eshared = .; /* End of shareable data */ |
Heiko Carstens | dfcc3e6 | 2009-10-06 10:33:57 +0200 | [diff] [blame] | 67 | _sdata = .; /* Start of data section */ |
Heiko Carstens | 162e006 | 2007-02-05 21:18:41 +0100 | [diff] [blame] | 68 | |
Heiko Carstens | d07a980 | 2016-06-07 10:12:55 +0200 | [diff] [blame] | 69 | . = ALIGN(PAGE_SIZE); |
| 70 | __start_ro_after_init = .; |
Jakub Kicinski | d7c19b0 | 2016-11-10 10:46:44 -0800 | [diff] [blame] | 71 | __start_data_ro_after_init = .; |
Heiko Carstens | d07a980 | 2016-06-07 10:12:55 +0200 | [diff] [blame] | 72 | .data..ro_after_init : { |
| 73 | *(.data..ro_after_init) |
| 74 | } |
Jakub Kicinski | d7c19b0 | 2016-11-10 10:46:44 -0800 | [diff] [blame] | 75 | __end_data_ro_after_init = .; |
Heiko Carstens | d07a980 | 2016-06-07 10:12:55 +0200 | [diff] [blame] | 76 | EXCEPTION_TABLE(16) |
| 77 | . = ALIGN(PAGE_SIZE); |
| 78 | __end_ro_after_init = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
Nelson Elhage | 04a95f6 | 2009-09-11 10:28:44 +0200 | [diff] [blame] | 80 | RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 82 | _edata = .; /* End of data section */ |
Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 83 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 84 | /* will be freed after init */ |
Sam Ravnborg | 52480ee | 2007-10-12 16:11:50 +0200 | [diff] [blame] | 85 | . = ALIGN(PAGE_SIZE); /* Init code and data */ |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 86 | __init_begin = .; |
Nelson Elhage | 04a95f6 | 2009-09-11 10:28:44 +0200 | [diff] [blame] | 87 | |
| 88 | INIT_TEXT_SECTION(PAGE_SIZE) |
| 89 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 90 | /* |
| 91 | * .exit.text is discarded at runtime, not link time, |
| 92 | * to deal with references from __bug_table |
| 93 | */ |
| 94 | .exit.text : { |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 95 | EXIT_TEXT |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 96 | } |
| 97 | |
Heiko Carstens | a4e6924 | 2013-02-11 14:26:24 +0100 | [diff] [blame] | 98 | .exit.data : { |
| 99 | EXIT_DATA |
| 100 | } |
| 101 | |
Vasily Gorbik | d69aa5e | 2018-04-27 07:36:39 +0200 | [diff] [blame] | 102 | /* |
| 103 | * struct alt_inst entries. From the header (alternative.h): |
| 104 | * "Alternative instructions for different CPU types or capabilities" |
| 105 | * Think locking instructions on spinlocks. |
| 106 | * Note, that it is a part of __init region. |
| 107 | */ |
| 108 | . = ALIGN(8); |
| 109 | .altinstructions : { |
| 110 | __alt_instructions = .; |
| 111 | *(.altinstructions) |
| 112 | __alt_instructions_end = .; |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | * And here are the replacement instructions. The linker sticks |
| 117 | * them as binary blobs. The .altinstructions has enough data to |
| 118 | * get the address and the length of them to patch the kernel safely. |
| 119 | * Note, that it is a part of __init region. |
| 120 | */ |
| 121 | .altinstr_replacement : { |
| 122 | *(.altinstr_replacement) |
| 123 | } |
| 124 | |
Martin Schwidefsky | 24fbc4e | 2018-04-27 07:36:47 +0200 | [diff] [blame] | 125 | /* |
| 126 | * Table with the patch locations to undo expolines |
| 127 | */ |
Josh Poimboeuf | 5e28b1c | 2022-08-26 16:55:44 -0700 | [diff] [blame^] | 128 | . = ALIGN(4); |
Martin Schwidefsky | 24fbc4e | 2018-04-27 07:36:47 +0200 | [diff] [blame] | 129 | .nospec_call_table : { |
| 130 | __nospec_call_start = . ; |
| 131 | *(.s390_indirect*) |
| 132 | __nospec_call_end = . ; |
| 133 | } |
| 134 | .nospec_return_table : { |
| 135 | __nospec_return_start = . ; |
| 136 | *(.s390_return*) |
| 137 | __nospec_return_end = . ; |
| 138 | } |
| 139 | |
Christian Borntraeger | 92e6ecf | 2009-03-26 15:23:58 +0100 | [diff] [blame] | 140 | /* early.c uses stsi, which requires page aligned data. */ |
| 141 | . = ALIGN(PAGE_SIZE); |
Nelson Elhage | 04a95f6 | 2009-09-11 10:28:44 +0200 | [diff] [blame] | 142 | INIT_DATA_SECTION(0x100) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Tejun Heo | 0415b00d1 | 2011-03-24 18:50:09 +0100 | [diff] [blame] | 144 | PERCPU_SECTION(0x100) |
Sam Ravnborg | 52480ee | 2007-10-12 16:11:50 +0200 | [diff] [blame] | 145 | . = ALIGN(PAGE_SIZE); |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 146 | __init_end = .; /* freed after init ends here */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Heiko Carstens | 0ccb32c | 2016-05-28 10:03:55 +0200 | [diff] [blame] | 148 | BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 150 | _end = . ; |
| 151 | |
Sam Ravnborg | e16af09 | 2007-10-12 16:11:49 +0200 | [diff] [blame] | 152 | /* Debugging sections. */ |
| 153 | STABS_DEBUG |
| 154 | DWARF_DEBUG |
Tejun Heo | 023bf6f | 2009-07-09 11:27:40 +0900 | [diff] [blame] | 155 | |
| 156 | /* Sections to be discarded */ |
| 157 | DISCARDS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | } |