[gPXE-devel] [PATCH] [efi] Fix the 32-bit version of elf2efi64

Stefan Hajnoczi stefanha at gmail.com
Sun Aug 1 07:48:18 EDT 2010


On Wed, Jul 21, 2010 at 3:23 AM, Geoff Lywood <glywood at vmware.com> wrote:
> 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, 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.
>
> The patch below should fix the problem. I tested this patch by building with all 4 combinations of 32- and 64-bit toolchains, targeting both 32- and 64-bit EFI. In each case, I used objdump to verify that the file format of bin-*-efi/snponly.efi matched what was expected. I also booted the 64-bit executable that was generated using the 32-bit toolchain.
>
> Thanks,
> Geoff
>
> VMware, Inc. is providing this patch to you under the terms of the GPL version 2 and any later version. This patch is provided as is, with no warranties or support. VMware disclaims all liability in connection with the use/inability to use this patch. Any use of the attached is considered acceptance of the above.
>
>
> Signed-off-by: Geoff Lywood <glywood at vmware.com>
> ---
>  src/Makefile.housekeeping |    4 ++--
>  src/util/elf2efi.c        |   20 ++++++++++----------
>  2 files changed, 12 insertions(+), 12 deletions(-)

Applied, thanks!

http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=c542da3f3d167a79903c6d4cfdbd97891513b954

Stefan


More information about the gPXE-devel mailing list