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