2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000 Russell King
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
2014-06-02 23:32:25 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_ENDIAN_BE8
|
|
|
|
#define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
|
|
|
|
(((x) >> 8) & 0x0000ff00) | \
|
|
|
|
(((x) << 8) & 0x00ff0000) | \
|
|
|
|
(((x) << 24) & 0xff000000) )
|
|
|
|
#else
|
|
|
|
#define ZIMAGE_MAGIC(x) (x)
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
OUTPUT_ARCH(arm)
|
|
|
|
ENTRY(_start)
|
|
|
|
SECTIONS
|
|
|
|
{
|
2009-02-16 17:41:36 +07:00
|
|
|
/DISCARD/ : {
|
|
|
|
*(.ARM.exidx*)
|
|
|
|
*(.ARM.extab*)
|
ARM: Eliminate decompressor -Dstatic= PIC hack
We used to build decompressors with -Dstatic= to avoid any local data
being generated. The problem is that local data generates GOTOFF
relocations, which means we can't relocate the data relative to the
text segment.
Global data, on the other hand, goes through the GOT, and can be
relocated anywhere.
Unfortunately, with the new decompressors, this presents a problem
since they declare static data within functions, and this leads to
stack overflow.
Fix this by separating out the decompressor code into a separate file,
and removing 'static' from BSS data in misc.c.
Also, discard the .data section - this means that should we end up
with read/write initialized data, the decompressor will fail to link
and the problem will be obvious.
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-02-25 19:14:40 +07:00
|
|
|
/*
|
|
|
|
* Discard any r/w data - this produces a link error if we have any,
|
|
|
|
* which is required for PIC decompression. Local data generates
|
|
|
|
* GOTOFF relocations, which prevents it being relocated independently
|
|
|
|
* of the text/got segments.
|
|
|
|
*/
|
|
|
|
*(.data)
|
2009-02-16 17:41:36 +07:00
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
. = TEXT_START;
|
|
|
|
_text = .;
|
|
|
|
|
|
|
|
.text : {
|
|
|
|
_start = .;
|
|
|
|
*(.start)
|
|
|
|
*(.text)
|
2006-04-10 01:08:42 +07:00
|
|
|
*(.text.*)
|
2005-04-17 05:20:36 +07:00
|
|
|
*(.fixup)
|
|
|
|
*(.gnu.warning)
|
2011-05-26 17:40:54 +07:00
|
|
|
*(.glue_7t)
|
|
|
|
*(.glue_7)
|
|
|
|
}
|
2017-09-22 00:10:19 +07:00
|
|
|
.table : ALIGN(4) {
|
|
|
|
_table_start = .;
|
|
|
|
LONG(ZIMAGE_MAGIC(2))
|
|
|
|
LONG(ZIMAGE_MAGIC(0x5a534c4b))
|
|
|
|
LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
|
|
|
|
LONG(ZIMAGE_MAGIC(_kernel_bss_size))
|
|
|
|
LONG(0)
|
|
|
|
_table_end = .;
|
|
|
|
}
|
2011-05-26 17:40:54 +07:00
|
|
|
.rodata : {
|
2005-04-17 05:20:36 +07:00
|
|
|
*(.rodata)
|
|
|
|
*(.rodata.*)
|
2017-10-23 18:39:32 +07:00
|
|
|
*(.data.rel.ro)
|
2011-05-26 17:40:54 +07:00
|
|
|
}
|
|
|
|
.piggydata : {
|
2005-04-17 05:20:36 +07:00
|
|
|
*(.piggydata)
|
2017-09-22 00:10:19 +07:00
|
|
|
__piggy_size_addr = . - 4;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2011-05-26 17:40:54 +07:00
|
|
|
. = ALIGN(4);
|
2005-04-17 05:20:36 +07:00
|
|
|
_etext = .;
|
|
|
|
|
2011-05-26 17:40:54 +07:00
|
|
|
.got.plt : { *(.got.plt) }
|
2005-04-17 05:20:36 +07:00
|
|
|
_got_start = .;
|
|
|
|
.got : { *(.got) }
|
|
|
|
_got_end = .;
|
2011-05-28 09:25:26 +07:00
|
|
|
|
|
|
|
/* ensure the zImage file size is always a multiple of 64 bits */
|
|
|
|
/* (without a dummy byte, ld just ignores the empty section) */
|
|
|
|
.pad : { BYTE(0); . = ALIGN(8); }
|
2017-08-19 02:49:44 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_EFI_STUB
|
|
|
|
.data : ALIGN(4096) {
|
|
|
|
__pecoff_data_start = .;
|
|
|
|
/*
|
|
|
|
* The EFI stub always executes from RAM, and runs strictly before the
|
|
|
|
* decompressor, so we can make an exception for its r/w data, and keep it
|
|
|
|
*/
|
|
|
|
*(.data.efistub)
|
|
|
|
__pecoff_data_end = .;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PE/COFF mandates a file size which is a multiple of 512 bytes if the
|
|
|
|
* section size equals or exceeds 4 KB
|
|
|
|
*/
|
|
|
|
. = ALIGN(512);
|
|
|
|
}
|
|
|
|
__pecoff_data_rawsize = . - ADDR(.data);
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
_edata = .;
|
|
|
|
|
2017-11-02 02:18:13 +07:00
|
|
|
/*
|
|
|
|
* The image_end section appears after any additional loadable sections
|
|
|
|
* that the linker may decide to insert in the binary image. Having
|
|
|
|
* this symbol allows further debug in the near future.
|
|
|
|
*/
|
|
|
|
.image_end (NOLOAD) : {
|
2017-10-23 18:39:32 +07:00
|
|
|
/*
|
|
|
|
* EFI requires that the image is aligned to 512 bytes, and appended
|
|
|
|
* DTB requires that we know where the end of the image is. Ensure
|
|
|
|
* that both are satisfied by ensuring that there are no additional
|
|
|
|
* sections emitted into the decompressor image.
|
|
|
|
*/
|
2017-11-02 02:18:13 +07:00
|
|
|
_edata_real = .;
|
|
|
|
}
|
|
|
|
|
2014-06-02 23:32:25 +07:00
|
|
|
_magic_sig = ZIMAGE_MAGIC(0x016f2818);
|
|
|
|
_magic_start = ZIMAGE_MAGIC(_start);
|
|
|
|
_magic_end = ZIMAGE_MAGIC(_edata);
|
2017-09-22 00:10:19 +07:00
|
|
|
_magic_table = ZIMAGE_MAGIC(_table_start - _start);
|
2014-06-02 23:32:25 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
. = BSS_START;
|
|
|
|
__bss_start = .;
|
|
|
|
.bss : { *(.bss) }
|
|
|
|
_end = .;
|
|
|
|
|
2011-04-22 08:45:08 +07:00
|
|
|
. = ALIGN(8); /* the stack must be 64-bit aligned */
|
2010-11-22 19:00:59 +07:00
|
|
|
.stack : { *(.stack) }
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2017-08-19 02:49:44 +07:00
|
|
|
PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
|
|
|
|
PROVIDE(__pecoff_end = ALIGN(512));
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
.stab 0 : { *(.stab) }
|
|
|
|
.stabstr 0 : { *(.stabstr) }
|
|
|
|
.stab.excl 0 : { *(.stab.excl) }
|
|
|
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
|
|
.stab.index 0 : { *(.stab.index) }
|
|
|
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
|
|
|
.comment 0 : { *(.comment) }
|
|
|
|
}
|
2017-10-23 18:39:32 +07:00
|
|
|
ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");
|