Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80803?usp=email )
Change subject: lib/program.ld: Make (NOLOAD) and to_load more explicit ......................................................................
lib/program.ld: Make (NOLOAD) and to_load more explicit
(NOLOAD) indicates that the section occupies no space in the file, but does take up space in memory during process execution. It's typically used for bss sections which contain uninitialized global/static variables.
to_load makes sure the section is part of the program headers. This is needed for instance with relocatable stages to know how much memory the program will use.
This fixes commit 99bf23c9e73c, which broke setups with a relocatable ramstage as the heap size was not accounted for when allocating memory in cbmem. The alloc code could trash higher cbmem entries in that case.
Change-Id: Ic14543ba580abe7a34c69bba714eae8cce504977 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/lib/program.ld 1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/80803/1
diff --git a/src/lib/program.ld b/src/lib/program.ld index 6d72d9e..1784447 100644 --- a/src/lib/program.ld +++ b/src/lib/program.ld @@ -68,7 +68,7 @@ LONG(0); LONG(0); __CTOR_END__ = .; -} +} : to_load #endif
/* Include data, bss, and heap in that order. Not defined for all stages. */ @@ -113,11 +113,11 @@ . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _edata = .; RECORD_SIZE(data) -} +} : to_load #endif
#if !ENV_SEPARATE_DATA_AND_BSS -.bss . : { +.bss . (NOLOAD) : { . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _bss = .; *(.bss) @@ -127,7 +127,7 @@ . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _ebss = .; RECORD_SIZE(bss) -} +} : to_load #endif
#if ENV_HAS_HEAP_SECTION @@ -138,7 +138,7 @@ . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _eheap = .; RECORD_SIZE(heap) -} +} : to_load #endif
#if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)