]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - arch/arm64/kernel/vmlinux.lds.S
Merge tag 'arc-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
[mirror_ubuntu-zesty-kernel.git] / arch / arm64 / kernel / vmlinux.lds.S
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>
11 #include <asm/pgtable.h>
12
13 #include "image.h"
14
15 /* .exit.text needed in case of alternative patching */
16 #define ARM_EXIT_KEEP(x) x
17 #define ARM_EXIT_DISCARD(x)
18
19 OUTPUT_ARCH(aarch64)
20 ENTRY(_text)
21
22 jiffies = jiffies_64;
23
24 #define HYPERVISOR_TEXT \
25 /* \
26 * Force the alignment to be compatible with \
27 * the vectors requirements \
28 */ \
29 . = ALIGN(2048); \
30 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
31 *(.hyp.idmap.text) \
32 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
33 VMLINUX_SYMBOL(__hyp_text_start) = .; \
34 *(.hyp.text) \
35 VMLINUX_SYMBOL(__hyp_text_end) = .;
36
37 /*
38 * The size of the PE/COFF section that covers the kernel image, which
39 * runs from stext to _edata, must be a round multiple of the PE/COFF
40 * FileAlignment, which we set to its minimum value of 0x200. 'stext'
41 * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
42 * boundary should be sufficient.
43 */
44 PECOFF_FILE_ALIGNMENT = 0x200;
45
46 #ifdef CONFIG_EFI
47 #define PECOFF_EDATA_PADDING \
48 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
49 #else
50 #define PECOFF_EDATA_PADDING
51 #endif
52
53 #ifdef CONFIG_DEBUG_ALIGN_RODATA
54 #define ALIGN_DEBUG_RO . = ALIGN(1<<SECTION_SHIFT);
55 #define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO
56 #else
57 #define ALIGN_DEBUG_RO
58 #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min);
59 #endif
60
61 SECTIONS
62 {
63 /*
64 * XXX: The linker does not define how output sections are
65 * assigned to input sections when there are multiple statements
66 * matching the same input section name. There is no documented
67 * order of matching.
68 */
69 /DISCARD/ : {
70 ARM_EXIT_DISCARD(EXIT_TEXT)
71 ARM_EXIT_DISCARD(EXIT_DATA)
72 EXIT_CALL
73 *(.discard)
74 *(.discard.*)
75 }
76
77 . = PAGE_OFFSET + TEXT_OFFSET;
78
79 .head.text : {
80 _text = .;
81 HEAD_TEXT
82 }
83 ALIGN_DEBUG_RO
84 .text : { /* Real text segment */
85 _stext = .; /* Text and read-only data */
86 __exception_text_start = .;
87 *(.exception.text)
88 __exception_text_end = .;
89 IRQENTRY_TEXT
90 TEXT_TEXT
91 SCHED_TEXT
92 LOCK_TEXT
93 HYPERVISOR_TEXT
94 *(.fixup)
95 *(.gnu.warning)
96 . = ALIGN(16);
97 *(.got) /* Global offset table */
98 }
99
100 ALIGN_DEBUG_RO
101 RO_DATA(PAGE_SIZE)
102 EXCEPTION_TABLE(8)
103 NOTES
104 ALIGN_DEBUG_RO
105 _etext = .; /* End of text and rodata section */
106
107 ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
108 __init_begin = .;
109
110 INIT_TEXT_SECTION(8)
111 .exit.text : {
112 ARM_EXIT_KEEP(EXIT_TEXT)
113 }
114
115 ALIGN_DEBUG_RO_MIN(16)
116 .init.data : {
117 INIT_DATA
118 INIT_SETUP(16)
119 INIT_CALLS
120 CON_INITCALL
121 SECURITY_INITCALL
122 INIT_RAM_FS
123 }
124 .exit.data : {
125 ARM_EXIT_KEEP(EXIT_DATA)
126 }
127
128 PERCPU_SECTION(64)
129
130 . = ALIGN(PAGE_SIZE);
131 __init_end = .;
132
133 . = ALIGN(4);
134 .altinstructions : {
135 __alt_instructions = .;
136 *(.altinstructions)
137 __alt_instructions_end = .;
138 }
139 .altinstr_replacement : {
140 *(.altinstr_replacement)
141 }
142
143 . = ALIGN(PAGE_SIZE);
144 _data = .;
145 _sdata = .;
146 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
147 PECOFF_EDATA_PADDING
148 _edata = .;
149
150 BSS_SECTION(0, 0, 0)
151
152 . = ALIGN(PAGE_SIZE);
153 idmap_pg_dir = .;
154 . += IDMAP_DIR_SIZE;
155 swapper_pg_dir = .;
156 . += SWAPPER_DIR_SIZE;
157
158 _end = .;
159
160 STABS_DEBUG
161
162 HEAD_SYMBOLS
163 }
164
165 /*
166 * The HYP init code can't be more than a page long.
167 */
168 ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
169 "HYP init code too big")
170
171 /*
172 * If padding is applied before .head.text, virt<->phys conversions will fail.
173 */
174 ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")