vmlinux.lds.S 3.18 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds's avatar
Linus Torvalds committed
2 3 4 5
/* ld script to make s390 Linux kernel
 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
 */

6
#include <asm/thread_info.h>
7
#include <asm/page.h>
8 9 10 11 12 13 14

/*
 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
 * make sure it has 16k alignment.
 */
#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)

15 16 17
/* Handle ro_after_init data on our own. */
#define RO_AFTER_INIT_DATA

Linus Torvalds's avatar
Linus Torvalds committed
18 19 20 21
#include <asm-generic/vmlinux.lds.h>

OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390:64-bit)
22
ENTRY(startup_continue)
Linus Torvalds's avatar
Linus Torvalds committed
23 24
jiffies = jiffies_64;

25 26 27 28 29 30
PHDRS {
	text PT_LOAD FLAGS(5);	/* R_E */
	data PT_LOAD FLAGS(7);	/* RWE */
	note PT_NOTE FLAGS(0);	/* ___ */
}

Linus Torvalds's avatar
Linus Torvalds committed
31 32
SECTIONS
{
33
	. = 0x100000;
34
	_stext = .;		/* Start of text section */
35
	.text : {
36
		/* Text and read-only data */
37
		_text = .;
38 39
		HEAD_TEXT
		TEXT_TEXT
40
		SCHED_TEXT
41
		CPUIDLE_TEXT
42 43
		LOCK_TEXT
		KPROBES_TEXT
44
		IRQENTRY_TEXT
45
		SOFTIRQENTRY_TEXT
46
		*(.text.*_indirect_*)
47 48
		*(.fixup)
		*(.gnu.warning)
Heiko Carstens's avatar
Heiko Carstens committed
49
	} :text = 0x0700
Linus Torvalds's avatar
Linus Torvalds committed
50

51
	. = ALIGN(PAGE_SIZE);
52
	_etext = .;		/* End of text section */
Linus Torvalds's avatar
Linus Torvalds committed
53

54 55
	NOTES :text :note

56 57
	.dummy : { *(.dummy) } :data

58
	RO_DATA_SECTION(PAGE_SIZE)
Linus Torvalds's avatar
Linus Torvalds committed
59

60
	. = ALIGN(PAGE_SIZE);
61
	_sdata = .;		/* Start of data section */
62

63 64 65 66 67 68 69 70
	. = ALIGN(PAGE_SIZE);
	__start_ro_after_init = .;
	.data..ro_after_init : {
		 *(.data..ro_after_init)
	}
	EXCEPTION_TABLE(16)
	. = ALIGN(PAGE_SIZE);
	__end_ro_after_init = .;
71

72
	RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
73 74 75 76

	_edata = .;		/* End of data section */

	/* will be freed after init */
77
	. = ALIGN(PAGE_SIZE);	/* Init code and data */
78
	__init_begin = .;
79

80 81
	. = ALIGN(PAGE_SIZE);
	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
82
		_sinittext = .;
83 84
		INIT_TEXT
		. = ALIGN(PAGE_SIZE);
85
		_einittext = .;
86
	}
87

88 89 90 91 92
	/*
	 * .exit.text is discarded at runtime, not link time,
	 * to deal with references from __bug_table
	*/
	.exit.text : {
93
		EXIT_TEXT
94 95
	}

96 97 98 99
	.exit.data : {
		EXIT_DATA
	}

100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
	/*
	 * struct alt_inst entries. From the header (alternative.h):
	 * "Alternative instructions for different CPU types or capabilities"
	 * Think locking instructions on spinlocks.
	 * Note, that it is a part of __init region.
	 */
	. = ALIGN(8);
	.altinstructions : {
		__alt_instructions = .;
		*(.altinstructions)
		__alt_instructions_end = .;
	}

	/*
	 * And here are the replacement instructions. The linker sticks
	 * them as binary blobs. The .altinstructions has enough data to
	 * get the address and the length of them to patch the kernel safely.
	 * Note, that it is a part of __init region.
	 */
	.altinstr_replacement : {
		*(.altinstr_replacement)
	}

123 124 125 126 127 128 129 130 131 132 133 134 135 136
	/*
	 * Table with the patch locations to undo expolines
	*/
	.nospec_call_table : {
		__nospec_call_start = . ;
		*(.s390_indirect*)
		__nospec_call_end = . ;
	}
	.nospec_return_table : {
		__nospec_return_start = . ;
		*(.s390_return*)
		__nospec_return_end = . ;
	}

137 138
	/* early.c uses stsi, which requires page aligned data. */
	. = ALIGN(PAGE_SIZE);
139
	INIT_DATA_SECTION(0x100)
140

141
	PERCPU_SECTION(0x100)
142
	. = ALIGN(PAGE_SIZE);
143 144
	__init_end = .;		/* freed after init ends here */

145
	BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
146 147 148 149 150 151

	_end = . ;

	/* Debugging sections.	*/
	STABS_DEBUG
	DWARF_DEBUG
152 153 154

	/* Sections to be discarded */
	DISCARDS
155 156 157
	/DISCARD/ : {
		*(.eh_frame)
	}
Linus Torvalds's avatar
Linus Torvalds committed
158
}