memtest86plus/build64
Martin Whitaker a4c9adc445 Fix the virtual memory addresses and sizes in the EFI image headers.
When the reloc and sbat sections were added by PR #34, three bugs were
introduced:

1. The virtual address and size fields in the PE headers were set to the
same values as the raw address and size fields. This is incorrect, because
the sections in the image file are aligned on 512 byte boundaries, but when
loaded into memory they need to be aligned on 4096 byte boundaries.

2. The value programmed into the SizeOfImage field was too large, as it
double-counted the region before the start of the .text section.

3. The value programmed into the SizeOfImage field no longer included the bss
size. That potentially allowed the EFI loader to load the image immediately
before a reserved region of memory without leaving enough space for the bss
section.

This commit fixes those bugs by calculating both file and virtual memory
offsets & sizes in the ld script. Note that we can't add a bss section to the
EFI image because many EFI loaders fail to load images that have uninitialised
data sections. Instead the text region size in virtual memory is increased
to include the bss size.

This fixes issue #243. It also eliminates the gaps between sections
observed in issue #202.
2023-02-02 14:01:13 +01:00
..
ldscripts Fix the virtual memory addresses and sizes in the EFI image headers. 2023-02-02 14:01:13 +01:00
Makefile Fix parallel build after d3d52b: boot/setup.S now contains #include "build_version.h", so that file needs to be generated beforehand. (#235) 2023-01-23 15:17:47 +01:00