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>
7 #include <asm-generic/vmlinux.lds.h>
8 #include <asm/thread_info.h>
9 #include <asm/memory.h>
11 #include <asm/pgtable.h>
15 /* .exit.text needed in case of alternative patching */
16 #define ARM_EXIT_KEEP(x) x
17 #define ARM_EXIT_DISCARD(x)
24 #define HYPERVISOR_TEXT \
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) \
34 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
36 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
37 VMLINUX_SYMBOL(__hyp_text_start) = .; \
39 VMLINUX_SYMBOL(__hyp_text_end) = .;
43 VMLINUX_SYMBOL(__idmap_text_start) = .; \
45 VMLINUX_SYMBOL(__idmap_text_end) = .;
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.
54 PECOFF_FILE_ALIGNMENT = 0x200;
57 #define PECOFF_EDATA_PADDING \
58 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
60 #define PECOFF_EDATA_PADDING
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
67 #define ALIGN_DEBUG_RO
68 #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min);
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
80 ARM_EXIT_DISCARD(EXIT_TEXT)
81 ARM_EXIT_DISCARD(EXIT_DATA)
87 . = PAGE_OFFSET + TEXT_OFFSET;
94 .text : { /* Real text segment */
95 _stext = .; /* Text and read-only data */
96 __exception_text_start = .;
98 __exception_text_end = .;
108 *(.got) /* Global offset table */
116 _etext = .; /* End of text and rodata section */
118 ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
123 ARM_EXIT_KEEP(EXIT_TEXT)
126 ALIGN_DEBUG_RO_MIN(16)
136 ARM_EXIT_KEEP(EXIT_DATA)
141 . = ALIGN(PAGE_SIZE);
146 __alt_instructions = .;
148 __alt_instructions_end = .;
150 .altinstr_replacement : {
151 *(.altinstr_replacement)
154 . = ALIGN(PAGE_SIZE);
157 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
163 . = ALIGN(PAGE_SIZE);
167 . += SWAPPER_DIR_SIZE;
177 * The HYP init code and ID map text can't be longer than a page each,
178 * and should not cross a page boundary.
180 ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
181 "HYP init code too big or misaligned")
182 ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
183 "ID map text too big or misaligned")
186 * If padding is applied before .head.text, virt<->phys conversions will fail.
188 ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")