]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Do not align VirtualSize for .reloc and .debug sections
authorMichael Brown <mcb30@ipxe.org>
Tue, 11 Jan 2022 15:27:14 +0000 (15:27 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 11 Jan 2022 15:27:14 +0000 (15:27 +0000)
commit91c77e2592f5b0e1098d3f341827d7e6925e4a85
treedbd4df33a1caaa0a98e51ca9078ae538a30c55d1
parentf43c2fd69749bb9a44f2a3ab61b6735938432b52
[efi] Do not align VirtualSize for .reloc and .debug sections

As of commit f1e9e2b ("[efi] Align EFI image sections by page size"),
the VirtualSize fields for the .reloc and .debug sections have been
rounded up to the (4kB) image alignment.  This breaks the PE
relocation logic in the UEFI shim, which requires the VirtualSize
field to exactly match the size as recorded in the data directory.

Fix by setting the VirtualSize field to the unaligned size of the
section, as is already done for normal PE sections (i.e. those other
than .reloc and .debug).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/elf2efi.c