summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMichael Brown2015-09-25 14:41:32 +0200
committerMichael Brown2015-09-25 14:41:32 +0200
commit7b976dd300c266c6f7e388b0dd65233cb9cb1ea5 (patch)
treed38e1ee8ea6a343c9ab62a6b7d707ba5dff6423c /src/util
parent[vmxnet3] Avoid completely filling the TX descriptor ring (diff)
downloadipxe-7b976dd300c266c6f7e388b0dd65233cb9cb1ea5.tar.gz
ipxe-7b976dd300c266c6f7e388b0dd65233cb9cb1ea5.tar.xz
ipxe-7b976dd300c266c6f7e388b0dd65233cb9cb1ea5.zip
[efi] Work around broken 32-bit PE executable parsing in ImageHlp.dll
The Microsoft PE/COFF specification defines the MajorLinkerVersion and MinorLinkerVersion fields as "The linker major version number" and "The linker minor version number" respectively, and has nothing more to say on the matter. These fields have no significance: they do not affect the interpretation of the remainder of the file, but merely provide diagnostic information for interested humans to read. Apparently, versions 2.4 and earlier of the Microsoft linker produced binaries so incorrigibly cursed that even to attempt to parse such a binary would risk summoning a plague of enraged spiders. To protect users from unwanted arachnids, ImageHlp.dll's MapAndLoad() function will helpfully fail to map and/or load a 32-bit binary unless the linker version field indicates version 2.5 or later. (64-bit binaries are exempt from such helpfulness.) Work around the broken Microsoft ImageHlp.dll library by providing a linker version number that will satisfy the arbitrary whims of the MapAndLoad() function. This mirrors wimboot commit 670c7e2 ("[efi] Work around broken 32-bit PE executable parsing in ImageHlp.dll"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/elf2efi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index bf6dae05..dee70ee7 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -92,6 +92,8 @@ static struct pe_header efi_pe_header = {
#elif defined(EFI_TARGET_X64)
.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC,
#endif
+ .MajorLinkerVersion = 42,
+ .MinorLinkerVersion = 42,
.SectionAlignment = EFI_FILE_ALIGN,
.FileAlignment = EFI_FILE_ALIGN,
.SizeOfImage = sizeof ( efi_pe_header ),