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