]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Mark PE images as large address aware
authorMichael Brown <mcb30@ipxe.org>
Wed, 22 Nov 2023 23:05:39 +0000 (23:05 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 23 Nov 2023 13:29:34 +0000 (13:29 +0000)
The images generated by elf2efi can be loaded anywhere in the address
space, and are not limited to the low 2GB.

Indicate this by setting the "large address aware" flag within the PE
header, for compatibility with EFI images generated by the EDK2 build
process.  (The EDK2 PE loader does not ever check this flag, and it is
unlikely that any other EFI PE loader ever does so, but we may as well
report it accurately.)

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

index f4d591d1e3e092a0c40e963ce357832d30028a65..b13ff43ebd4273cff2bf12aa2f948a513fa6b435 100644 (file)
@@ -215,6 +215,7 @@ static struct pe_header efi_pe_header = {
                                             DataDirectory[0] ) ) ),
                        .Characteristics = ( EFI_IMAGE_FILE_DLL |
                                             EFI_IMAGE_FILE_MACHINE |
+                                            EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE|
                                             EFI_IMAGE_FILE_EXECUTABLE_IMAGE ),
                },
                .OptionalHeader = {