EFI images have wrong machine type for 32-bit ARM
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Using the triplet `thumbv7-w64-mingw32` and (e.g.) `-Wl,--subsystem,efi_boot_service_driver` you can create EFI images for 32-bit ARM, but these don't load without a bit of tweaking. EFI is expecting an image type of IMAGE_FILE_MACHINE_ARMTHUMB_MIXED (0x1c2), but lld is outputting IMAGE_FILE_MACHINE_ARMNT, 0x1c4, which I believe is what 32-bit ARM Windows uses. See also the gnu-efi linker script for this: https://github.com/rhboot/gnu-efi/blob/master/gnuefi/crt0-efi-arm.S
If lld gets passed a subsystem which begins with "efi_", it should be outputting a machine type of 0x1c2 rather than 0x1c4.
Contributor guide
Research direction
Start by tracing lld's handling of EFI subsystems for the thumbv7-w64-mingw32 target and compare its machine-type selection with the referenced gnu-efi linker script. Done means EFI subsystems emit IMAGE_FILE_MACHINE_ARMTHUMB_MIXED (0x1c2) instead of IMAGE_FILE_MACHINE_ARMNT (0x1c4), with coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100