Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
[deliverable/linux.git] / arch / arm64 / kernel / vmlinux.lds.S
CommitLineData
8c2c3df3
CM
1/*
2 * ld script to make ARM Linux kernel
3 * taken from the i386 version by Russell King
4 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 */
6
7#include <asm-generic/vmlinux.lds.h>
8#include <asm/thread_info.h>
9#include <asm/memory.h>
10#include <asm/page.h>
da141706 11#include <asm/pgtable.h>
8c2c3df3 12
a2c1d73b
MR
13#include "image.h"
14
07c802bd
WD
15/* .exit.text needed in case of alternative patching */
16#define ARM_EXIT_KEEP(x) x
17#define ARM_EXIT_DISCARD(x)
8c2c3df3
CM
18
19OUTPUT_ARCH(aarch64)
af885f40 20ENTRY(_text)
8c2c3df3
CM
21
22jiffies = jiffies_64;
23
2240bbb6
MZ
24#define HYPERVISOR_TEXT \
25 /* \
06f75a1f
AB
26 * Align to 4 KB so that \
27 * a) the HYP vector table is at its minimum \
28 * alignment of 2048 bytes \
29 * b) the HYP init code will not cross a page \
30 * boundary if its size does not exceed \
31 * 4 KB (see related ASSERT() below) \
2240bbb6 32 */ \
06f75a1f 33 . = ALIGN(SZ_4K); \
2240bbb6
MZ
34 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
35 *(.hyp.idmap.text) \
36 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
37 VMLINUX_SYMBOL(__hyp_text_start) = .; \
38 *(.hyp.text) \
39 VMLINUX_SYMBOL(__hyp_text_end) = .;
40
5dfe9d7d
AB
41#define IDMAP_TEXT \
42 . = ALIGN(SZ_4K); \
43 VMLINUX_SYMBOL(__idmap_text_start) = .; \
44 *(.idmap.text) \
45 VMLINUX_SYMBOL(__idmap_text_end) = .;
46
a352ea3e
AB
47/*
48 * The size of the PE/COFF section that covers the kernel image, which
49 * runs from stext to _edata, must be a round multiple of the PE/COFF
50 * FileAlignment, which we set to its minimum value of 0x200. 'stext'
51 * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
52 * boundary should be sufficient.
53 */
54PECOFF_FILE_ALIGNMENT = 0x200;
55
56#ifdef CONFIG_EFI
57#define PECOFF_EDATA_PADDING \
58 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
59#else
60#define PECOFF_EDATA_PADDING
61#endif
62
da141706
LA
63#ifdef CONFIG_DEBUG_ALIGN_RODATA
64#define ALIGN_DEBUG_RO . = ALIGN(1<<SECTION_SHIFT);
65#define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO
66#else
67#define ALIGN_DEBUG_RO
68#define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min);
69#endif
70
8c2c3df3
CM
71SECTIONS
72{
73 /*
74 * XXX: The linker does not define how output sections are
75 * assigned to input sections when there are multiple statements
76 * matching the same input section name. There is no documented
77 * order of matching.
78 */
79 /DISCARD/ : {
80 ARM_EXIT_DISCARD(EXIT_TEXT)
81 ARM_EXIT_DISCARD(EXIT_DATA)
82 EXIT_CALL
83 *(.discard)
84 *(.discard.*)
85 }
86
87 . = PAGE_OFFSET + TEXT_OFFSET;
88
89 .head.text : {
90 _text = .;
91 HEAD_TEXT
92 }
da141706 93 ALIGN_DEBUG_RO
8c2c3df3
CM
94 .text : { /* Real text segment */
95 _stext = .; /* Text and read-only data */
8c2c3df3
CM
96 __exception_text_start = .;
97 *(.exception.text)
98 __exception_text_end = .;
99 IRQENTRY_TEXT
100 TEXT_TEXT
101 SCHED_TEXT
102 LOCK_TEXT
2240bbb6 103 HYPERVISOR_TEXT
5dfe9d7d 104 IDMAP_TEXT
8c2c3df3
CM
105 *(.fixup)
106 *(.gnu.warning)
107 . = ALIGN(16);
108 *(.got) /* Global offset table */
109 }
110
da141706 111 ALIGN_DEBUG_RO
8c2c3df3 112 RO_DATA(PAGE_SIZE)
adace895 113 EXCEPTION_TABLE(8)
c80b7ee8 114 NOTES
da141706 115 ALIGN_DEBUG_RO
8c2c3df3
CM
116 _etext = .; /* End of text and rodata section */
117
da141706 118 ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
8c2c3df3
CM
119 __init_begin = .;
120
121 INIT_TEXT_SECTION(8)
122 .exit.text : {
123 ARM_EXIT_KEEP(EXIT_TEXT)
124 }
da141706
LA
125
126 ALIGN_DEBUG_RO_MIN(16)
8c2c3df3
CM
127 .init.data : {
128 INIT_DATA
129 INIT_SETUP(16)
130 INIT_CALLS
131 CON_INITCALL
132 SECURITY_INITCALL
133 INIT_RAM_FS
134 }
135 .exit.data : {
136 ARM_EXIT_KEEP(EXIT_DATA)
137 }
138
139 PERCPU_SECTION(64)
140
562c85ca 141 . = ALIGN(PAGE_SIZE);
8c2c3df3 142 __init_end = .;
3c620626 143
e039ee4e
AP
144 . = ALIGN(4);
145 .altinstructions : {
146 __alt_instructions = .;
147 *(.altinstructions)
148 __alt_instructions_end = .;
149 }
150 .altinstr_replacement : {
151 *(.altinstr_replacement)
152 }
153
154 . = ALIGN(PAGE_SIZE);
3c620626 155 _data = .;
3c620626
MS
156 _sdata = .;
157 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
a352ea3e 158 PECOFF_EDATA_PADDING
3c620626 159 _edata = .;
8c2c3df3 160
8c2c3df3 161 BSS_SECTION(0, 0, 0)
bd00cd5f
MR
162
163 . = ALIGN(PAGE_SIZE);
164 idmap_pg_dir = .;
165 . += IDMAP_DIR_SIZE;
166 swapper_pg_dir = .;
167 . += SWAPPER_DIR_SIZE;
168
8c2c3df3
CM
169 _end = .;
170
171 STABS_DEBUG
a2c1d73b
MR
172
173 HEAD_SYMBOLS
8c2c3df3 174}
2240bbb6
MZ
175
176/*
5dfe9d7d 177 * The HYP init code and ID map text can't be longer than a page each,
06f75a1f 178 * and should not cross a page boundary.
2240bbb6 179 */
06f75a1f
AB
180ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
181 "HYP init code too big or misaligned")
5dfe9d7d
AB
182ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
183 "ID map text too big or misaligned")
da57a369
MR
184
185/*
186 * If padding is applied before .head.text, virt<->phys conversions will fail.
187 */
188ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")
This page took 0.167979 seconds and 5 git commands to generate.