aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-04-05 13:41:53 +0100
committerMichael Brown <mcb30@ipxe.org>2023-04-10 16:50:10 +0100
commit0d04635ef0e4fa0850716c03163e120c63125df7 (patch)
tree31f7bbe3e7566e21688d7400a42ce8f649d3fc48
parent1d1cf74a5e58811822bee4b3da3cff7282fcdfca (diff)
downloadipxe-0d04635ef0e4fa0850716c03163e120c63125df7.zip
ipxe-0d04635ef0e4fa0850716c03163e120c63125df7.tar.gz
ipxe-0d04635ef0e4fa0850716c03163e120c63125df7.tar.bz2
[efi] Remove redundant zero padding in PE header
Hybrid bzImage and UEFI binaries (such as wimboot) require the PE header to be kept as small as possible, since the bzImage header starts at a fixed offset 0x1f1. The PE header currently includes 128 bytes of zero padding between the DOS and NT header portions. This padding has been present since commit 81d92c6 ("[efi] Add EFI image format and basic runtime environment") first added support for EFI images in iPXE, and was included on the basis of matching the observed behaviour of the Microsoft toolchain. There appears to be no requirement for this padding to exist: EDK2 binaries built with gcc include only 64 bytes of zero padding, Linux kernel binaries include 66 bytes of non-zero padding, and wimboot binaries include no padding at all. Remove the unnecessary padding between the DOS and NT header portions to minimise the overall size of the PE header. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/util/elf2efi.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index cea9abf..159f14e 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -191,7 +191,6 @@ struct pe_relocs {
struct pe_header {
EFI_IMAGE_DOS_HEADER dos;
- uint8_t padding[128];
EFI_IMAGE_NT_HEADERS nt;
};