Files
s390-tools/zipl/boot/stage3.lds.S
Frank Heimes 6fc450f696 (genprotimg|zipl)/boot: discard .note.package ELF section to save memory
The .note.package [1] section is not used by the zipl/genprotimg bootloaders,
therefore discard them via linker script.

This fix solves the error:
 /usr/bin/ld: Heap section doesn't conform to the described memory layout
 collect2: error: ld returned 1 exit status
 make[4]: *** [Makefile:77: stage3a.elf] Error 1
 make[4]: Leaving directory '/<>/genprotimg/boot'
 make[3]: *** [Makefile:20: all-recursive] Error 1
 make[3]: Leaving directory '/<>/genprotimg'
 make[2]: *** [Makefile:56: genprotimg] Error 2

[1] https://systemd.io/ELF_PACKAGE_METADATA/

Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/174
Closes: https://github.com/ibm-s390-linux/s390-tools/pull/176
[seiden@linux.ibm.com: Add/edit fixes tags]
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-09-13 19:14:16 +02:00

80 lines
1.6 KiB
ArmAsm

/*
* Memory layout for stage 3
* =========================
*
* General memory layout
* ---------------------
*
* 0x0000-0x1fff Lowcore
* 0x2000-0x5fff Memory allocation (heap)
* 0x6000-0x8fff free
* 0x9000-0x9fff Stage3 parameter
* 0xa000-0xdfff Stage3 code + data
* 0xf000-0xffff Stack
*/
#include "boot/loaders_layout.h"
#include "boot/s390.h"
SECTIONS
{
. = 0x0;
. = STAGE3_HEAP_ADDRESS;
__heap_start = .;
.heap : {
. += STAGE3_HEAP_SIZE;
ASSERT(__heap_stop - __heap_start == STAGE3_HEAP_SIZE,
"Heap section doesn't conform to the described memory layout");
}
__heap_stop = .;
/* stage 3 parameter */
. = STAGE3_PARAMS_ADDRESS;
_stage3_parms = .;
. = STAGE3_ENTRY;
.text.start : { *(.text.start) }
.text : { *(.text) }
__ex_table_start = .;
.ex_table : { *(.ex_table) }
__ex_table_stop = .;
__bss_start = .;
.bss : { *(.bss) }
__bss_stop = .;
.rodata : {*(.rodata) }
.data : { *(.data) }
/* Trailer needed for Secure Boot */
. = COMMAND_LINE_EXTRA - 32;
.sb.trailer : {
QUAD(0x0000c00000000000)
QUAD(STAGE3_ENTRY + PSW_LOAD)
QUAD(STAGE3_ENTRY)
QUAD(0x000000207a49504c)
}
. = COMMAND_LINE_EXTRA;
.cmdline_extra : {
. += COMMAND_LINE_EXTRA_SIZE;
}
. = STAGE3_STACK_ADDRESS;
__stack_start = .;
.stack : {
. += STAGE3_STACK_SIZE;
ASSERT(__stack_end - __stack_start == STAGE3_STACK_SIZE,
"Stack section doesn't conform to the described memory layout");
}
__stack_end = .;
/* Sections to be discarded */
/DISCARD/ : {
*(.eh_frame)
*(.interp)
*(.note.GNU-stack)
*(.note.package)
}
}