Target triple to support "x86_64-unknown-uefi"
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Added changes to the Driver.cpp.
This version uses underlying MSVC toolchain to compile UEFI target introduced here.
clang/lib/Basic/Targets/X86.h | ||
---|---|---|
839–855 | According to https://wiki.osdev.org/UEFI#Calling_Conventions, only cdecl, Microsoft's 64-bit calling convention and ARM SMC are supported for UEFI. This would translate to CC_C and CC_Win64 (I'm not sure if SMC is supported by Clang, it doesn't appear to be). |
clang/lib/Driver/ToolChains/UEFI.cpp | ||
---|---|---|
42–46 | I'd hardcode and inline this for simplicity, this toolchain is only used for x86_64 and arm64 right now so now need to duplicate that here. | |
49–50 | I'd hardcode and inline this for simplicity, this toolchain is only used for x86_64 and arm64 right now so now need to duplicate that here. | |
53 | I'd inline this. | |
56–57 | I'd hardcode and inline this for simplicity, this toolchain is only used for x86_64 and arm64 right now so now need to duplicate that here. | |
60 | I'd inline this. | |
clang/lib/Driver/ToolChains/UEFI.h | ||
23 | You also need HasNativeLLVMSupport, see https://github.com/llvm/llvm-project/blob/46dee4a3a3dfb372a0eaa0b4490c80be2f421f29/clang/lib/Driver/ToolChains/Fuchsia.h#L43 | |
29 | You'll also need to override buildLinker since the default implementation doesn't do anything, see https://github.com/llvm/llvm-project/blob/46dee4a3a3dfb372a0eaa0b4490c80be2f421f29/clang/lib/Driver/ToolChain.cpp#L319 I'd hardcode it to use lld-link for simplicty. You can use Fuchsia's implementation for inspiration (although the flags are going to be different since Fuchsia uses ld.lld, not lld-link): https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Fuchsia.h#L17-L34 |
Added UEFI toolchain. Constructing linker and started a WIP UEFI toolchain to break away from MSVC toolchain.
Not ready for review yet. Updating build files and tests.
Fixed a compile time error.
Simplifying the patch to include just the scaffolding for X86_64 platform.
Removing the predefines to be added as a separate patch.
I'd split the llvm/ changes into a separate change.
clang/lib/Driver/ToolChains/UEFI.cpp | ||
---|---|---|
59–60 | I don't think these should be needed for UEFI targets. | |
llvm/test/ExecutionEngine/RuntimeDyld/X86/coff-alignment.ll | ||
4 ↗ | (On Diff #528064) | Should this be uefi? |
llvm/test/Instrumentation/InstrProfiling/profiling.ll | ||
10 ↗ | (On Diff #528064) | Should this be uefi? |
llvm/test/Transforms/PGOProfile/comdat_rename.ll | ||
3 ↗ | (On Diff #528064) | Should this be uefi? |
I'd omit the lit test cases for now since they're not necessary. There should be a test case in https://github.com/llvm/llvm-project/blob/86b6ac5d54d7fe5cd21beff64b5c2194b1368bdf/llvm/unittests/TargetParser/TripleTest.cpp though.
Can you also provide description for this change (this should be the same you'll use for the Git message).
llvm/include/llvm/MC/TargetRegistry.h | ||
---|---|---|
568 | Nit: phrasing. | |
llvm/lib/MC/MCContext.cpp | ||
90 | Nit: update the error message. | |
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | ||
1521 | Nit: consistent case in assert messages. |
What does this comment refer to?