xref: /openbmc/linux/arch/s390/kernel/vmlinux.lds.S (revision 4ed91d48259d9ddd378424d008f2e6559f7e78f8)
1/* ld script to make s390 Linux kernel
2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
3 */
4
5#include <asm/thread_info.h>
6#include <asm/page.h>
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
14/* Handle ro_after_init data on our own. */
15#define RO_AFTER_INIT_DATA
16
17#include <asm-generic/vmlinux.lds.h>
18
19OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
20OUTPUT_ARCH(s390:64-bit)
21ENTRY(startup)
22jiffies = jiffies_64;
23
24PHDRS {
25	text PT_LOAD FLAGS(5);	/* R_E */
26	data PT_LOAD FLAGS(7);	/* RWE */
27	note PT_NOTE FLAGS(0);	/* ___ */
28}
29
30SECTIONS
31{
32	. = 0x00000000;
33	.text : {
34	_text = .;		/* Text and read-only data */
35		HEAD_TEXT
36		TEXT_TEXT
37		SCHED_TEXT
38		CPUIDLE_TEXT
39		LOCK_TEXT
40		KPROBES_TEXT
41		IRQENTRY_TEXT
42		SOFTIRQENTRY_TEXT
43		*(.fixup)
44		*(.gnu.warning)
45	} :text = 0x0700
46
47	. = ALIGN(PAGE_SIZE);
48	_etext = .;		/* End of text section */
49
50	NOTES :text :note
51
52	.dummy : { *(.dummy) } :data
53
54	RO_DATA_SECTION(PAGE_SIZE)
55
56#ifdef CONFIG_SHARED_KERNEL
57	. = ALIGN(0x100000);	/* VM shared segments are 1MB aligned */
58#endif
59
60	. = ALIGN(PAGE_SIZE);
61	_eshared = .;		/* End of shareable data */
62	_sdata = .;		/* Start of data section */
63
64	. = ALIGN(PAGE_SIZE);
65	__start_ro_after_init = .;
66	__start_data_ro_after_init = .;
67	.data..ro_after_init : {
68		 *(.data..ro_after_init)
69	}
70	__end_data_ro_after_init = .;
71	EXCEPTION_TABLE(16)
72	. = ALIGN(PAGE_SIZE);
73	__end_ro_after_init = .;
74
75	RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
76
77	_edata = .;		/* End of data section */
78
79	/* will be freed after init */
80	. = ALIGN(PAGE_SIZE);	/* Init code and data */
81	__init_begin = .;
82
83	. = ALIGN(PAGE_SIZE);
84	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
85		VMLINUX_SYMBOL(_sinittext) = . ;
86		INIT_TEXT
87		. = ALIGN(PAGE_SIZE);
88		VMLINUX_SYMBOL(_einittext) = . ;
89	}
90
91	/*
92	 * .exit.text is discarded at runtime, not link time,
93	 * to deal with references from __bug_table
94	*/
95	.exit.text : {
96		EXIT_TEXT
97	}
98
99	.exit.data : {
100		EXIT_DATA
101	}
102
103	/* early.c uses stsi, which requires page aligned data. */
104	. = ALIGN(PAGE_SIZE);
105	INIT_DATA_SECTION(0x100)
106
107	PERCPU_SECTION(0x100)
108	. = ALIGN(PAGE_SIZE);
109	__init_end = .;		/* freed after init ends here */
110
111	BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
112
113	_end = . ;
114
115	/* Debugging sections.	*/
116	STABS_DEBUG
117	DWARF_DEBUG
118
119	/* Sections to be discarded */
120	DISCARDS
121}
122