1/* SPDX-License-Identifier: GPL-2.0 */
2#include <asm-generic/vmlinux.lds.h>
3#include <asm/vmlinux.lds.h>
4#include <asm/thread_info.h>
5#include <asm/page.h>
6#include <asm/sclp.h>
7#include "boot.h"
8
9OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
10OUTPUT_ARCH(s390:64-bit)
11
12ENTRY(startup)
13
14SECTIONS
15{
16	. = 0;
17	.ipldata : {
18		*(.ipldata)
19	}
20	. = IPL_START;
21	.head.text : {
22		_head = . ;
23		HEAD_TEXT
24		_ehead = . ;
25	}
26	. = PARMAREA;
27	.parmarea : {
28		*(.parmarea)
29	}
30	.text :	{
31		_text = .;	/* Text */
32		*(.text)
33		*(.text.*)
34		_etext = . ;
35	}
36	.rodata : {
37		_rodata = . ;
38		*(.rodata)	 /* read-only data */
39		*(.rodata.*)
40		_erodata = . ;
41	}
42	NOTES
43	.data :	{
44		_data = . ;
45		*(.data)
46		*(.data.*)
47		_edata = . ;
48	}
49
50	BOOT_DATA
51	BOOT_DATA_PRESERVED
52
53	/*
54	 * This is the BSS section of the decompressor and not of the decompressed Linux kernel.
55	 * It will consume place in the decompressor's image.
56	 */
57	. = ALIGN(8);
58	.bss : {
59		_bss = . ;
60		*(.bss)
61		*(.bss.*)
62		*(COMMON)
63		/*
64		 * Stacks for the decompressor
65		 */
66		. = ALIGN(PAGE_SIZE);
67		_dump_info_stack_start = .;
68		. += PAGE_SIZE;
69		_dump_info_stack_end = .;
70		. = ALIGN(PAGE_SIZE);
71		_stack_start = .;
72		. += BOOT_STACK_SIZE;
73		_stack_end = .;
74		_ebss = .;
75	}
76
77	/*
78	 * uncompressed image info used by the decompressor it should match
79	 * struct vmlinux_info. It comes from .vmlinux.info section of
80	 * uncompressed vmlinux in a form of info.o
81	 */
82	. = ALIGN(8);
83	.vmlinux.info : {
84		_vmlinux_info = .;
85		*(.vmlinux.info)
86	}
87
88	.decompressor.syms : {
89		. += 1; /* make sure we have \0 before the first entry */
90		. = ALIGN(2);
91		_decompressor_syms_start = .;
92		*(.decompressor.syms)
93		_decompressor_syms_end = .;
94	}
95
96#ifdef CONFIG_KERNEL_UNCOMPRESSED
97	. = 0x100000;
98#else
99	. = ALIGN(8);
100#endif
101	.rodata.compressed : {
102		_compressed_start = .;
103		*(.vmlinux.bin.compressed)
104		_compressed_end = .;
105	}
106
107#define SB_TRAILER_SIZE 32
108	/* Trailer needed for Secure Boot */
109	. += SB_TRAILER_SIZE; /* make sure .sb.trailer does not overwrite the previous section */
110	. = ALIGN(4096) - SB_TRAILER_SIZE;
111	.sb.trailer : {
112		QUAD(0)
113		QUAD(0)
114		QUAD(0)
115		QUAD(0x000000207a49504c)
116	}
117	_end = .;
118
119	/* Sections to be discarded */
120	/DISCARD/ : {
121		*(.eh_frame)
122		*(__ex_table)
123		*(*__ksymtab*)
124		*(___kcrctab*)
125	}
126}
127