• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#include <asm-generic/vmlinux.lds.h>
8
9OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
10OUTPUT_ARCH(s390:64-bit)
11ENTRY(startup)
12jiffies = jiffies_64;
13
14PHDRS {
15	text PT_LOAD FLAGS(5);	/* R_E */
16	data PT_LOAD FLAGS(7);	/* RWE */
17	note PT_NOTE FLAGS(0);	/* ___ */
18}
19
20SECTIONS
21{
22	. = 0x00000000;
23	.text : {
24		/* Text and read-only data */
25		HEAD_TEXT
26		/*
27		 * E.g. perf doesn't like symbols starting at address zero,
28		 * therefore skip the initial PSW and channel program located
29		 * at address zero and let _text start at 0x200.
30		 */
31	_text = 0x200;
32		TEXT_TEXT
33		SCHED_TEXT
34		LOCK_TEXT
35		KPROBES_TEXT
36		IRQENTRY_TEXT
37		SOFTIRQENTRY_TEXT
38		*(.fixup)
39		*(.gnu.warning)
40	} :text = 0x0700
41
42	_etext = .;		/* End of text section */
43
44	NOTES :text :note
45
46	.dummy : { *(.dummy) } :data
47
48	RO_DATA_SECTION(PAGE_SIZE)
49
50#ifdef CONFIG_SHARED_KERNEL
51	. = ALIGN(0x100000);	/* VM shared segments are 1MB aligned */
52#endif
53
54	. = ALIGN(PAGE_SIZE);
55	_eshared = .;		/* End of shareable data */
56	_sdata = .;		/* Start of data section */
57
58	EXCEPTION_TABLE(16) :data
59
60	RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
61
62	_edata = .;		/* End of data section */
63
64	/* will be freed after init */
65	. = ALIGN(PAGE_SIZE);	/* Init code and data */
66	__init_begin = .;
67
68	INIT_TEXT_SECTION(PAGE_SIZE)
69
70	/*
71	 * .exit.text is discarded at runtime, not link time,
72	 * to deal with references from __bug_table
73	*/
74	.exit.text : {
75		EXIT_TEXT
76	}
77
78	.exit.data : {
79		EXIT_DATA
80	}
81
82	/*
83	 * struct alt_inst entries. From the header (alternative.h):
84	 * "Alternative instructions for different CPU types or capabilities"
85	 * Think locking instructions on spinlocks.
86	 * Note, that it is a part of __init region.
87	 */
88	. = ALIGN(8);
89	.altinstructions : {
90		__alt_instructions = .;
91		*(.altinstructions)
92		__alt_instructions_end = .;
93	}
94
95	/*
96	 * And here are the replacement instructions. The linker sticks
97	 * them as binary blobs. The .altinstructions has enough data to
98	 * get the address and the length of them to patch the kernel safely.
99	 * Note, that it is a part of __init region.
100	 */
101	.altinstr_replacement : {
102		*(.altinstr_replacement)
103	}
104
105	/*
106	 * Table with the patch locations to undo expolines
107	*/
108	.nospec_call_table : {
109		__nospec_call_start = . ;
110		*(.s390_indirect*)
111		__nospec_call_end = . ;
112	}
113	.nospec_return_table : {
114		__nospec_return_start = . ;
115		*(.s390_return*)
116		__nospec_return_end = . ;
117	}
118
119	/* early.c uses stsi, which requires page aligned data. */
120	. = ALIGN(PAGE_SIZE);
121	INIT_DATA_SECTION(0x100)
122
123	PERCPU_SECTION(0x100)
124	. = ALIGN(PAGE_SIZE);
125	__init_end = .;		/* freed after init ends here */
126
127	BSS_SECTION(0, 2, 0)
128
129	_end = . ;
130
131	/* Debugging sections.	*/
132	STABS_DEBUG
133	DWARF_DEBUG
134
135	/* Sections to be discarded */
136	DISCARDS
137}
138