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 * Force the alignment to be compatible with \
27 * the vectors requirements \
30 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
32 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
33 VMLINUX_SYMBOL(__hyp_text_start) = .; \
35 VMLINUX_SYMBOL(__hyp_text_end) = .;
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.
44 PECOFF_FILE_ALIGNMENT = 0x200;
47 #define PECOFF_EDATA_PADDING \
48 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
50 #define PECOFF_EDATA_PADDING
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
57 #define ALIGN_DEBUG_RO
58 #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min);
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
70 ARM_EXIT_DISCARD(EXIT_TEXT)
71 ARM_EXIT_DISCARD(EXIT_DATA)
77 . = PAGE_OFFSET + TEXT_OFFSET;
84 .text : { /* Real text segment */
85 _stext = .; /* Text and read-only data */
86 __exception_text_start = .;
88 __exception_text_end = .;
97 *(.got) /* Global offset table */
105 _etext = .; /* End of text and rodata section */
107 ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
112 ARM_EXIT_KEEP(EXIT_TEXT)
115 ALIGN_DEBUG_RO_MIN(16)
125 ARM_EXIT_KEEP(EXIT_DATA)
130 . = ALIGN(PAGE_SIZE);
135 __alt_instructions = .;
137 __alt_instructions_end = .;
139 .altinstr_replacement : {
140 *(.altinstr_replacement)
143 . = ALIGN(PAGE_SIZE);
146 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
152 . = ALIGN(PAGE_SIZE);
156 . += SWAPPER_DIR_SIZE;
166 * The HYP init code can't be more than a page long.
168 ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
169 "HYP init code too big")
172 * If padding is applied before .head.text, virt<->phys conversions will fail.
174 ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")