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