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