.bss -> .text in linker script. Will it be zero-initialized?
Posted: Thu May 13, 2021 2:49 am
Ignoring the size inflation from doing such a thing in the first place, will ld zero-initialize the range of memory that corresponds to the input .bss section, or should I assume it to be link-time garbage? Is there a way to force ld to zero-initialize this memory?
Code: Select all
OUTPUT_FORMAT("elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(kmain)
SECTIONS
{
. = 0;
.text : {
*(.text)
*(.data)
*(.bss)
*(.rodata*)
}
_kernel_end = .;
}