To compile UEFI applications using Clang, we currently use Windows target triple (e.g.
x86_64-pc-windows-msvc). We would like to introduce a first-class UEFI environment support to compile UEFI applications where only UEFI constraints are included and not the Windows ABI or API interoperability constraints. We intend to add support for this UEFI environment incrementally beginning with the introduction of UEFI specific target triple. The immediate focus and proposed implementation will cover Driver and Tool support for UEFI. Eventually, we would like to port runtime, compiler-rt builtins, libc and libc++ libraries.
This is an informal specification for a minimum viable implementation.
- Introduce a new LLVM Triple
- https://reviews.llvm.org/D131594 - This change has already landed.
- Add UEFI toolchain support to the Clang driver.
- https://reviews.llvm.org/D152206 - This change is under review.
- For each of the target architectures, implement a UEFI
We make some assumptions regarding certain aspects of the UEFI compilations that are not explicitly mentioned in the UEFI specification. This is to simplify the early implementation and we expect to expand the support as and when new projects are onboarded and require changes to these assumptions:
- Default subsystem -
- Default entry point -
The following macro defines will be part of the implementation.
- If this macro can be set for all PE-COFF targets (i.e. UEFI and Windows PE-COFF targets), it can be useful.
This effort is carried out by the Fuchsia toolchain team at Google which I am part of. We plan to compile the UEFI early bring up code used by the Zircon kernel with the new target.
We plan to provide a simple UEFI example that can be compiled and run on QEMU using the new target for demonstration and testing purposes. We fully welcome comments, questions and suggestions from the community on this effort.