1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* ld script to make s390 Linux kernel
3 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
6 #include <asm/thread_info.h>
10 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
11 * make sure it has 16k alignment.
13 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) \
14 *(.bss..invalid_pg_dir)
16 /* Handle ro_after_init data on our own. */
17 #define RO_AFTER_INIT_DATA
21 #include <asm-generic/vmlinux.lds.h>
22 #include <asm/vmlinux.lds.h>
24 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
25 OUTPUT_ARCH(s390:64-bit)
26 ENTRY(startup_continue)
30 text PT_LOAD FLAGS(5); /* R_E */
31 data PT_LOAD FLAGS(7); /* RWE */
32 note PT_NOTE FLAGS(0); /* ___ */
39 _stext = .; /* Start of text section */
40 _text = .; /* Text and read-only data */
53 _etext = .; /* End of text section */
59 _sdata = .; /* Start of data section */
62 __start_ro_after_init = .;
63 .data..ro_after_init : {
64 *(.data..ro_after_init)
69 __end_ro_after_init = .;
71 RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE)
74 _edata = .; /* End of data section */
76 /* will be freed after init */
77 . = ALIGN(PAGE_SIZE); /* Init code and data */
81 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
89 * .exit.text is discarded at runtime, not link time,
90 * to deal with references from __bug_table
101 * struct alt_inst entries. From the header (alternative.h):
102 * "Alternative instructions for different CPU types or capabilities"
103 * Think locking instructions on spinlocks.
104 * Note, that it is a part of __init region.
108 __alt_instructions = .;
110 __alt_instructions_end = .;
114 * And here are the replacement instructions. The linker sticks
115 * them as binary blobs. The .altinstructions has enough data to
116 * get the address and the length of them to patch the kernel safely.
117 * Note, that it is a part of __init region.
119 .altinstr_replacement : {
120 *(.altinstr_replacement)
124 * Table with the patch locations to undo expolines
126 .nospec_call_table : {
127 __nospec_call_start = . ;
129 __nospec_call_end = . ;
131 .nospec_return_table : {
132 __nospec_return_start = . ;
134 __nospec_return_end = . ;
139 /* early.c uses stsi, which requires page aligned data. */
140 . = ALIGN(PAGE_SIZE);
141 INIT_DATA_SECTION(0x100)
143 PERCPU_SECTION(0x100)
150 .rela.dyn ALIGN(8) : {
151 __rela_dyn_start = .;
156 . = ALIGN(PAGE_SIZE);
157 __init_end = .; /* freed after init ends here */
159 BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
164 * uncompressed image info used by the decompressor
165 * it should match struct vmlinux_info
167 .vmlinux.info 0 (INFO) : {
168 QUAD(_stext) /* default_lma */
169 QUAD(startup_continue) /* entry */
170 QUAD(__bss_start - _stext) /* image_size */
171 QUAD(__bss_stop - __bss_start) /* bss_size */
172 QUAD(__boot_data_start) /* bootdata_off */
173 QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */
174 QUAD(__boot_data_preserved_start) /* bootdata_preserved_off */
175 QUAD(__boot_data_preserved_end -
176 __boot_data_preserved_start) /* bootdata_preserved_size */
177 QUAD(__dynsym_start) /* dynsym_start */
178 QUAD(__rela_dyn_start) /* rela_dyn_start */
179 QUAD(__rela_dyn_end) /* rela_dyn_end */
182 /* Debugging sections. */
187 /* Sections to be discarded */