]> git.ipfire.org Git - thirdparty/linux.git/blob - arch/arm/boot/compressed/vmlinux.lds.S
Merge tag 'efi-core-2020-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git...
[thirdparty/linux.git] / arch / arm / boot / compressed / vmlinux.lds.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2000 Russell King
4 */
5
6 #ifdef CONFIG_CPU_ENDIAN_BE8
7 #define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
8 (((x) >> 8) & 0x0000ff00) | \
9 (((x) << 8) & 0x00ff0000) | \
10 (((x) << 24) & 0xff000000) )
11 #else
12 #define ZIMAGE_MAGIC(x) (x)
13 #endif
14
15 OUTPUT_ARCH(arm)
16 ENTRY(_start)
17 SECTIONS
18 {
19 /DISCARD/ : {
20 *(.ARM.exidx*)
21 *(.ARM.extab*)
22 /*
23 * Discard any r/w data - this produces a link error if we have any,
24 * which is required for PIC decompression. Local data generates
25 * GOTOFF relocations, which prevents it being relocated independently
26 * of the text/got segments.
27 */
28 *(.data)
29 }
30
31 . = TEXT_START;
32 _text = .;
33
34 .text : {
35 _start = .;
36 *(.start)
37 *(.text)
38 *(.text.*)
39 *(.gnu.warning)
40 *(.glue_7t)
41 *(.glue_7)
42 }
43 .table : ALIGN(4) {
44 _table_start = .;
45 LONG(ZIMAGE_MAGIC(4))
46 LONG(ZIMAGE_MAGIC(0x5a534c4b))
47 LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
48 LONG(ZIMAGE_MAGIC(_kernel_bss_size))
49 LONG(0)
50 _table_end = .;
51 }
52 .rodata : {
53 *(.rodata)
54 *(.rodata.*)
55 *(.data.rel.ro)
56 }
57 .piggydata : {
58 *(.piggydata)
59 __piggy_size_addr = . - 4;
60 }
61
62 . = ALIGN(4);
63 _etext = .;
64
65 .got.plt : { *(.got.plt) }
66 _got_start = .;
67 .got : { *(.got) }
68 _got_end = .;
69
70 /* ensure the zImage file size is always a multiple of 64 bits */
71 /* (without a dummy byte, ld just ignores the empty section) */
72 .pad : { BYTE(0); . = ALIGN(8); }
73
74 #ifdef CONFIG_EFI_STUB
75 .data : ALIGN(4096) {
76 __pecoff_data_start = .;
77 /*
78 * The EFI stub always executes from RAM, and runs strictly before the
79 * decompressor, so we can make an exception for its r/w data, and keep it
80 */
81 *(.data.efistub .bss.efistub)
82 __pecoff_data_end = .;
83
84 /*
85 * PE/COFF mandates a file size which is a multiple of 512 bytes if the
86 * section size equals or exceeds 4 KB
87 */
88 . = ALIGN(512);
89 }
90 __pecoff_data_rawsize = . - ADDR(.data);
91 #endif
92
93 _edata = .;
94
95 /*
96 * The image_end section appears after any additional loadable sections
97 * that the linker may decide to insert in the binary image. Having
98 * this symbol allows further debug in the near future.
99 */
100 .image_end (NOLOAD) : {
101 /*
102 * EFI requires that the image is aligned to 512 bytes, and appended
103 * DTB requires that we know where the end of the image is. Ensure
104 * that both are satisfied by ensuring that there are no additional
105 * sections emitted into the decompressor image.
106 */
107 _edata_real = .;
108 }
109
110 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
111 _magic_start = ZIMAGE_MAGIC(_start);
112 _magic_end = ZIMAGE_MAGIC(_edata);
113 _magic_table = ZIMAGE_MAGIC(_table_start - _start);
114
115 . = BSS_START;
116 __bss_start = .;
117 .bss : { *(.bss) }
118 _end = .;
119
120 . = ALIGN(8); /* the stack must be 64-bit aligned */
121 .stack : { *(.stack) }
122
123 PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
124 PROVIDE(__pecoff_end = ALIGN(512));
125
126 .stab 0 : { *(.stab) }
127 .stabstr 0 : { *(.stabstr) }
128 .stab.excl 0 : { *(.stab.excl) }
129 .stab.exclstr 0 : { *(.stab.exclstr) }
130 .stab.index 0 : { *(.stab.index) }
131 .stab.indexstr 0 : { *(.stab.indexstr) }
132 .comment 0 : { *(.comment) }
133 }
134 ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");