]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Allow elf2efi to be used for hybrid binaries
authorMichael Brown <mcb30@ipxe.org>
Wed, 5 Apr 2023 12:29:29 +0000 (13:29 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 10 Apr 2023 15:51:51 +0000 (16:51 +0100)
commit9fb28080d97fac1061660befacfad8caaa2bc522
tree98d57b8bfb4b7621298e310cae09a17c3d009f21
parent1e4c3789e95393a1b87a0b2147bed82a87576673
[efi] Allow elf2efi to be used for hybrid binaries

Hybrid 32-bit BIOS and 64-bit UEFI binaries (such as wimboot) may
include R_X86_64_32 relocation records for the 32-bit BIOS portions.
These should be ignored when generating PE relocation records, since
they apply only to code that cannot be executed within the context of
the 64-bit UEFI binary, and creating a 4-byte relocation record is
invalid in a binary that may be relocated anywhere within the 64-bit
address space (see commit 907cffb "[efi] Disallow R_X86_64_32
relocations").

Add a "--hybrid" option to elf2efi, which will cause R_X86_64_32
relocation records to be silently discarded.

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