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