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>
14 /* .exit.text needed in case of alternative patching */
15 #define ARM_EXIT_KEEP(x) x
16 #define ARM_EXIT_DISCARD(x)
23 #define HYPERVISOR_TEXT \
25 * Force the alignment to be compatible with \
26 * the vectors requirements \
29 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
31 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
32 VMLINUX_SYMBOL(__hyp_text_start) = .; \
34 VMLINUX_SYMBOL(__hyp_text_end) = .;
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.
43 PECOFF_FILE_ALIGNMENT = 0x200;
46 #define PECOFF_EDATA_PADDING \
47 .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
49 #define PECOFF_EDATA_PADDING
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
61 ARM_EXIT_DISCARD(EXIT_TEXT)
62 ARM_EXIT_DISCARD(EXIT_DATA)
68 . = PAGE_OFFSET + TEXT_OFFSET;
74 .text : { /* Real text segment */
75 _stext = .; /* Text and read-only data */
76 __exception_text_start = .;
78 __exception_text_end = .;
87 *(.got) /* Global offset table */
93 _etext = .; /* End of text and rodata section */
100 ARM_EXIT_KEEP(EXIT_TEXT)
112 ARM_EXIT_KEEP(EXIT_DATA)
117 . = ALIGN(PAGE_SIZE);
122 __alt_instructions = .;
124 __alt_instructions_end = .;
126 .altinstr_replacement : {
127 *(.altinstr_replacement)
130 . = ALIGN(PAGE_SIZE);
133 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
139 . = ALIGN(PAGE_SIZE);
143 . += SWAPPER_DIR_SIZE;
153 * The HYP init code can't be more than a page long.
155 ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
156 "HYP init code too big")
159 * If padding is applied before .head.text, virt<->phys conversions will fail.
161 ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")