Open emaste opened 2 weeks ago
@llvm/issue-subscribers-tools-llvm-objcopy-strip
Author: Ed Maste (emaste)
Just to clarify, when you say PE UEFI binaries, are these a form of the PE/COFF file format?
llvm-objcopy is written such that the internal object representations are file-format specific, with the exception of binary and ihex output being able to come from at least ELF output. I suspect you'd need to find a way to massage an ELF Object into a COFF Object within the code somehow.
systemd had the same issue for their systemd-boot EFI binary. They wrote their own "ELF to PE" objcopy in python as a workaround https://github.com/systemd/systemd/blob/a13ead6814a9907eeee9406a969b1678b028026f/tools/elf2efi.py
Ideally we'd get #76838. Is there another usecase for --output-target=efi-app-x86_64
should this PR land?
@Jannik2099 -- I will be relanding #76838 in PR #109364 I have a draft PR #109320 up for X86_64 backend which I will be working on landing next. I expect to have a few iterations on both the Driver implementation and the backend code in the next few weeks to reliably use the new UEFI target triple.
@Prabhuk do you also plan to add at least an aarch64 target afterwards? Otherwise I don't think this'll have much real world use, as everyone would have to keep the objcopy logic around for aarch64 EFI binaries.
@Jannik2099 Yes that is the plan.
In FreeBSD we build our UEFI loader by linking an ELF object, and using ELF Tool Chain's objcopy to convert that to a PE EFI binary, using
--output-target=efi-app-x86_64
.Invocation:
Gentoo Linux encountered a similar issue, building app-crypt/sbsigntools: https://bugs.gentoo.org/733016
We are working on migrating to LLVM binutils replacements, and this is one issue that's a dependency of that change.
Related FreeBSD bugs: