efi_loader: correct SizeOfCode, SizeOfInitializedData

The fields SizeOfCode, SizeOfInitializedData, and SizeOfUninitializedData
are define in the PE-COFF specification [1].

* SizeOfCode must match the size of all .text sections.
* SizeOfInitializedData must match the size of all .data sections.
* SizeOfUninitializedData must match the size of all .bss sections.

We only have one .text and one .data section. SizeOfCode and
SizeOfInitializedData have to be calculated as the difference between
the end and the start of the respective section.

As we don't have any .bss sections in the generated EFI binaries.
SizeOfUninitializedData must remain 0.

[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 files changed