1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2000 Russell King
5 #include <asm/vmlinux.lds.h>
7 #ifdef CONFIG_CPU_ENDIAN_BE8
8 #define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
9 (((x) >> 8) & 0x0000ff00) | \
10 (((x) << 8) & 0x00ff0000) | \
11 (((x) << 24) & 0xff000000) )
13 #define ZIMAGE_MAGIC(x) (x)
28 * Discard any r/w data - this produces a link error if we have any,
29 * which is required for PIC decompression. Local data generates
30 * GOTOFF relocations, which prevents it being relocated independently
31 * of the text/got segments.
49 LONG(ZIMAGE_MAGIC(0x5a534c4b))
50 LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
51 LONG(ZIMAGE_MAGIC(_kernel_bss_size))
52 LONG(ZIMAGE_MAGIC(TEXT_OFFSET))
53 LONG(ZIMAGE_MAGIC(MALLOC_SIZE))
65 __piggy_size_addr = . - 4;
71 .got.plt : { *(.got.plt) }
72 #ifndef CONFIG_EFI_STUB
78 /* ensure the zImage file size is always a multiple of 64 bits */
79 /* (without a dummy byte, ld just ignores the empty section) */
80 .pad : { BYTE(0); . = ALIGN(8); }
82 #ifdef CONFIG_EFI_STUB
84 __pecoff_data_start = .;
89 * The EFI stub always executes from RAM, and runs strictly before the
90 * decompressor, so we can make an exception for its r/w data, and keep it
92 *(.data.efistub .bss.efistub)
93 __pecoff_data_end = .;
96 * PE/COFF mandates a file size which is a multiple of 512 bytes if the
97 * section size equals or exceeds 4 KB
101 __pecoff_data_rawsize = . - ADDR(.data);
107 * The image_end section appears after any additional loadable sections
108 * that the linker may decide to insert in the binary image. Having
109 * this symbol allows further debug in the near future.
111 .image_end (NOLOAD) : {
113 * EFI requires that the image is aligned to 512 bytes, and appended
114 * DTB requires that we know where the end of the image is. Ensure
115 * that both are satisfied by ensuring that there are no additional
116 * sections emitted into the decompressor image.
121 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
122 _magic_start = ZIMAGE_MAGIC(_start);
123 _magic_end = ZIMAGE_MAGIC(_edata);
124 _magic_table = ZIMAGE_MAGIC(_table_start - _start);
128 .bss : { *(.bss .bss.*) }
131 . = ALIGN(8); /* the stack must be 64-bit aligned */
132 .stack : { *(.stack) }
134 PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
135 PROVIDE(__pecoff_end = ALIGN(512));
143 ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");