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/kernel-pgtable.h>
9 #include <asm/thread_info.h>
10 #include <asm/memory.h>
12 #include <asm/pgtable.h>
16 /* .exit.text needed in case of alternative patching */
17 #define ARM_EXIT_KEEP(x) x
18 #define ARM_EXIT_DISCARD(x)
25 #define HYPERVISOR_TEXT \
27 * Align to 4 KB so that \
28 * a) the HYP vector table is at its minimum \
29 * alignment of 2048 bytes \
30 * b) the HYP init code will not cross a page \
31 * boundary if its size does not exceed \
32 * 4 KB (see related ASSERT() below) \
35 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
37 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
38 VMLINUX_SYMBOL(__hyp_text_start) = .; \
40 VMLINUX_SYMBOL(__hyp_text_end) = .;
44 VMLINUX_SYMBOL(__idmap_text_start) = .; \
46 VMLINUX_SYMBOL(__idmap_text_end) = .;
49 * The size of the PE/COFF section that covers the kernel image, which
50 * runs from stext to _edata, must be a round multiple of the PE/COFF
51 * FileAlignment, which we set to its minimum value of 0x200. 'stext'
52 * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
53 * boundary should be sufficient.
55 PECOFF_FILE_ALIGNMENT = 0x200;
58 #define PECOFF_EDATA_PADDING \
59 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
61 #define PECOFF_EDATA_PADDING
64 #if defined(CONFIG_DEBUG_ALIGN_RODATA)
65 #define ALIGN_DEBUG_RO . = ALIGN(1<<SECTION_SHIFT);
66 #define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO
67 #elif defined(CONFIG_DEBUG_RODATA)
68 #define ALIGN_DEBUG_RO . = ALIGN(1<<PAGE_SHIFT);
69 #define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO
71 #define ALIGN_DEBUG_RO
72 #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min);
78 * XXX: The linker does not define how output sections are
79 * assigned to input sections when there are multiple statements
80 * matching the same input section name. There is no documented
84 ARM_EXIT_DISCARD(EXIT_TEXT)
85 ARM_EXIT_DISCARD(EXIT_DATA)
91 . = PAGE_OFFSET + TEXT_OFFSET;
98 .text : { /* Real text segment */
99 _stext = .; /* Text and read-only data */
100 __exception_text_start = .;
102 __exception_text_end = .;
112 *(.got) /* Global offset table */
120 _etext = .; /* End of text and rodata section */
122 ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
127 ARM_EXIT_KEEP(EXIT_TEXT)
130 ALIGN_DEBUG_RO_MIN(16)
140 ARM_EXIT_KEEP(EXIT_DATA)
145 . = ALIGN(PAGE_SIZE);
150 __alt_instructions = .;
152 __alt_instructions_end = .;
154 .altinstr_replacement : {
155 *(.altinstr_replacement)
158 . = ALIGN(PAGE_SIZE);
161 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
167 . = ALIGN(PAGE_SIZE);
171 . += SWAPPER_DIR_SIZE;
181 * The HYP init code and ID map text can't be longer than a page each,
182 * and should not cross a page boundary.
184 ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
185 "HYP init code too big or misaligned")
186 ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
187 "ID map text too big or misaligned")
190 * If padding is applied before .head.text, virt<->phys conversions will fail.
192 ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")