blob: dd96b467946ba6161202efcc774e14475afe642e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* ld script to make s390 Linux kernel
2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
3 */
4
Heiko Carstens0778dc32008-11-27 11:05:58 +01005#include <asm/thread_info.h>
Sam Ravnborg52480ee2007-10-12 16:11:50 +02006#include <asm/page.h>
Heiko Carstens0ccb32c2016-05-28 10:03:55 +02007
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 Carstensd07a9802016-06-07 10:12:55 +020014/* Handle ro_after_init data on our own. */
15#define RO_AFTER_INIT_DATA
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm-generic/vmlinux.lds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Linus Torvalds1da177e2005-04-16 15:20:36 -070019OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
20OUTPUT_ARCH(s390:64-bit)
Christian Borntraegere0a15d52012-01-18 18:03:39 +010021ENTRY(startup)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022jiffies = jiffies_64;
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010024PHDRS {
25 text PT_LOAD FLAGS(5); /* R_E */
26 data PT_LOAD FLAGS(7); /* RWE */
27 note PT_NOTE FLAGS(0); /* ___ */
28}
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030SECTIONS
31{
Sam Ravnborge16af092007-10-12 16:11:49 +020032 . = 0x00000000;
33 .text : {
Heiko Carstens26c18cb2017-05-04 09:42:22 +020034 /* Text and read-only data */
Tim Abbott2133bb82009-04-25 22:11:06 -040035 HEAD_TEXT
Heiko Carstens26c18cb2017-05-04 09:42:22 +020036 /*
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 Abbott2133bb82009-04-25 22:11:06 -040042 TEXT_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020043 SCHED_TEXT
Chris Metcalf6727ad92016-10-07 17:02:55 -070044 CPUIDLE_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020045 LOCK_TEXT
46 KPROBES_TEXT
Heiko Carstens88dbd202009-06-12 10:26:46 +020047 IRQENTRY_TEXT
Alexander Potapenkobe7635e2016-03-25 14:22:05 -070048 SOFTIRQENTRY_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020049 *(.fixup)
50 *(.gnu.warning)
Heiko Carstensa817a612008-02-05 16:50:38 +010051 } :text = 0x0700
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Sam Ravnborge16af092007-10-12 16:11:49 +020053 _etext = .; /* End of text section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010055 NOTES :text :note
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010056
Martin Schwidefsky7a2512b2011-11-14 11:19:02 +010057 .dummy : { *(.dummy) } :data
58
Heiko Carstens56280b12012-07-24 16:32:39 +020059 RO_DATA_SECTION(PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
61#ifdef CONFIG_SHARED_KERNEL
Sam Ravnborg52480ee2007-10-12 16:11:50 +020062 . = ALIGN(0x100000); /* VM shared segments are 1MB aligned */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#endif
64
Sam Ravnborg52480ee2007-10-12 16:11:50 +020065 . = ALIGN(PAGE_SIZE);
Sam Ravnborge16af092007-10-12 16:11:49 +020066 _eshared = .; /* End of shareable data */
Heiko Carstensdfcc3e62009-10-06 10:33:57 +020067 _sdata = .; /* Start of data section */
Heiko Carstens162e0062007-02-05 21:18:41 +010068
Heiko Carstensd07a9802016-06-07 10:12:55 +020069 . = ALIGN(PAGE_SIZE);
70 __start_ro_after_init = .;
Jakub Kicinskid7c19b02016-11-10 10:46:44 -080071 __start_data_ro_after_init = .;
Heiko Carstensd07a9802016-06-07 10:12:55 +020072 .data..ro_after_init : {
73 *(.data..ro_after_init)
74 }
Jakub Kicinskid7c19b02016-11-10 10:46:44 -080075 __end_data_ro_after_init = .;
Heiko Carstensd07a9802016-06-07 10:12:55 +020076 EXCEPTION_TABLE(16)
77 . = ALIGN(PAGE_SIZE);
78 __end_ro_after_init = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Nelson Elhage04a95f62009-09-11 10:28:44 +020080 RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Sam Ravnborge16af092007-10-12 16:11:49 +020082 _edata = .; /* End of data section */
Heiko Carstensc0007f12007-04-27 16:01:42 +020083
Sam Ravnborge16af092007-10-12 16:11:49 +020084 /* will be freed after init */
Sam Ravnborg52480ee2007-10-12 16:11:50 +020085 . = ALIGN(PAGE_SIZE); /* Init code and data */
Sam Ravnborge16af092007-10-12 16:11:49 +020086 __init_begin = .;
Nelson Elhage04a95f62009-09-11 10:28:44 +020087
88 INIT_TEXT_SECTION(PAGE_SIZE)
89
Sam Ravnborge16af092007-10-12 16:11:49 +020090 /*
91 * .exit.text is discarded at runtime, not link time,
92 * to deal with references from __bug_table
93 */
94 .exit.text : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010095 EXIT_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020096 }
97
Heiko Carstensa4e69242013-02-11 14:26:24 +010098 .exit.data : {
99 EXIT_DATA
100 }
101
Vasily Gorbikd69aa5e2018-04-27 07:36:39 +0200102 /*
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 Schwidefsky24fbc4e2018-04-27 07:36:47 +0200125 /*
126 * Table with the patch locations to undo expolines
127 */
128 .nospec_call_table : {
129 __nospec_call_start = . ;
130 *(.s390_indirect*)
131 __nospec_call_end = . ;
132 }
133 .nospec_return_table : {
134 __nospec_return_start = . ;
135 *(.s390_return*)
136 __nospec_return_end = . ;
137 }
138
Christian Borntraeger92e6ecf2009-03-26 15:23:58 +0100139 /* early.c uses stsi, which requires page aligned data. */
140 . = ALIGN(PAGE_SIZE);
Nelson Elhage04a95f62009-09-11 10:28:44 +0200141 INIT_DATA_SECTION(0x100)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
Tejun Heo0415b00d12011-03-24 18:50:09 +0100143 PERCPU_SECTION(0x100)
Sam Ravnborg52480ee2007-10-12 16:11:50 +0200144 . = ALIGN(PAGE_SIZE);
Sam Ravnborge16af092007-10-12 16:11:49 +0200145 __init_end = .; /* freed after init ends here */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Heiko Carstens0ccb32c2016-05-28 10:03:55 +0200147 BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
Sam Ravnborge16af092007-10-12 16:11:49 +0200149 _end = . ;
150
Sam Ravnborge16af092007-10-12 16:11:49 +0200151 /* Debugging sections. */
152 STABS_DEBUG
153 DWARF_DEBUG
Tejun Heo023bf6f2009-07-09 11:27:40 +0900154
155 /* Sections to be discarded */
156 DISCARDS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157}