Include BSS in init_size.

This commit is contained in:
Martin Whitaker 2020-07-04 10:40:34 +01:00
parent 4573faa78c
commit b6ff7f6ec9
3 changed files with 6 additions and 4 deletions

View File

@ -100,10 +100,12 @@ memtest_shared.bin: memtest_shared
objcopy -O binary $< memtest_shared.bin
memtest.bin: memtest_shared.bin boot/bootsect.o boot/setup.o ldscripts/memtest_bin.lds
$(LD) -T ldscripts/memtest_bin.lds boot/bootsect.o boot/setup.o -b binary memtest_shared.bin -o memtest.bin
$(eval SIZES=$(shell size -G -d memtest_shared | grep memtest_shared))
$(LD) --defsym=_bss_size=$(word 3,$(SIZES)) -T ldscripts/memtest_bin.lds boot/bootsect.o boot/setup.o -b binary memtest_shared.bin -o memtest.bin
memtest.efi: memtest_shared.bin boot/header.o boot/setup.o ldscripts/memtest_efi.lds
$(LD) -T ldscripts/memtest_efi.lds boot/header.o boot/setup.o -b binary memtest_shared.bin -o memtest.efi
$(eval SIZES=$(shell size -G -d memtest_shared | grep memtest_shared))
$(LD) --defsym=_bss_size=$(word 3,$(SIZES)) -T ldscripts/memtest_efi.lds boot/header.o boot/setup.o -b binary memtest_shared.bin -o memtest.efi
memtest.img: memtest.bin
dd if=/dev/zero of=memtest.img bs=1474560 count=1

View File

@ -16,5 +16,5 @@ SECTIONS {
_end = . ;
}
_sys_size = (_end - _start + 15) >> 4;
_init_size = (_end - _start);
_init_size = (_end - _start) + _bss_size;
}

View File

@ -21,5 +21,5 @@ SECTIONS {
_text_size = (_text_end - _text_start);
_sys_size = _text_size >> 4;
_init_size = _text_size;
_init_size = _text_size + _bss_size;
}