1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2000 Russell King
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) )
12 #define ZIMAGE_MAGIC(x) (x)
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.
46 LONG(ZIMAGE_MAGIC(0x5a534c4b))
47 LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
48 LONG(ZIMAGE_MAGIC(_kernel_bss_size))
59 __piggy_size_addr = . - 4;
65 .got.plt : { *(.got.plt) }
66 #ifndef CONFIG_EFI_STUB
72 /* ensure the zImage file size is always a multiple of 64 bits */
73 /* (without a dummy byte, ld just ignores the empty section) */
74 .pad : { BYTE(0); . = ALIGN(8); }
76 #ifdef CONFIG_EFI_STUB
78 __pecoff_data_start = .;
83 * The EFI stub always executes from RAM, and runs strictly before the
84 * decompressor, so we can make an exception for its r/w data, and keep it
86 *(.data.efistub .bss.efistub)
87 __pecoff_data_end = .;
90 * PE/COFF mandates a file size which is a multiple of 512 bytes if the
91 * section size equals or exceeds 4 KB
95 __pecoff_data_rawsize = . - ADDR(.data);
101 * The image_end section appears after any additional loadable sections
102 * that the linker may decide to insert in the binary image. Having
103 * this symbol allows further debug in the near future.
105 .image_end (NOLOAD) : {
107 * EFI requires that the image is aligned to 512 bytes, and appended
108 * DTB requires that we know where the end of the image is. Ensure
109 * that both are satisfied by ensuring that there are no additional
110 * sections emitted into the decompressor image.
115 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
116 _magic_start = ZIMAGE_MAGIC(_start);
117 _magic_end = ZIMAGE_MAGIC(_edata);
118 _magic_table = ZIMAGE_MAGIC(_table_start - _start);
125 . = ALIGN(8); /* the stack must be 64-bit aligned */
126 .stack : { *(.stack) }
128 PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
129 PROVIDE(__pecoff_end = ALIGN(512));
131 .stab 0 : { *(.stab) }
132 .stabstr 0 : { *(.stabstr) }
133 .stab.excl 0 : { *(.stab.excl) }
134 .stab.exclstr 0 : { *(.stab.exclstr) }
135 .stab.index 0 : { *(.stab.index) }
136 .stab.indexstr 0 : { *(.stab.indexstr) }
137 .comment 0 : { *(.comment) }
139 ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");