iPXE - Open Source Boot Firmware

[efi] Fix the 32-bit version of elf2efi64
authorGeoff Lywood <glywood@vmware.com>
Wed, 21 Jul 2010 02:23:02 +0000 (19:23 -0700)
committerMichael Brown <mcb30@ipxe.org>
Wed, 21 Jul 2010 11:41:41 +0000 (12:41 +0100)
commitb8dd94686bf452292163763687d11cdea5c723b1
treeca8a68a8796af32f088886724dac6499296d89ba
parent1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45
[efi] Fix the 32-bit version of elf2efi64

Currently, if elf2efi.c is compiled using a 32-bit HOST_CC, then the
resulting elf2efi64 binary will generate 32-bit EFI binaries instead
of 64-bit EFI binaries.

The problem is that elf2efi.c uses the MDE_CPU_* definitions to decide
whether to output a 32-bit or 64-bit PE binary.  However, MDE_CPU_*
gets defined in ProcessorBind.h, depending on the compiler's target
architecture.  Overriding them on the command line doesn't work in the
expected way, and you can end up in cases where both MDE_CPU_IA32 and
MDE_CPU_X64 are defined.

Fix by using a separate definition, EFI_TARGET_IA32/EFI_TARGET_X64,
which is specified only on the command line.

Signed-off-by: Geoff Lywood <glywood@vmware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.housekeeping
src/util/elf2efi.c