Target triple to support "x86_64-unknown-uefi"
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
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 | ||
---|---|---|
812–828 | 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 | ||
---|---|---|
41–45 ↗ | (On Diff #477634) | 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. |
48–49 ↗ | (On Diff #477634) | 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. |
52 ↗ | (On Diff #477634) | I'd inline this. |
55–56 ↗ | (On Diff #477634) | 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. |
59 ↗ | (On Diff #477634) | I'd inline this. |
clang/lib/Driver/ToolChains/UEFI.h | ||
22 ↗ | (On Diff #477634) | You also need HasNativeLLVMSupport, see https://github.com/llvm/llvm-project/blob/46dee4a3a3dfb372a0eaa0b4490c80be2f421f29/clang/lib/Driver/ToolChains/Fuchsia.h#L43 |
28 ↗ | (On Diff #477634) | 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 | ||
---|---|---|
58–59 ↗ | (On Diff #528064) | 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 ↗ | (On Diff #528610) | Nit: phrasing. |
llvm/lib/MC/MCContext.cpp | ||
90 ↗ | (On Diff #528610) | Nit: update the error message. |
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | ||
1521 ↗ | (On Diff #528610) | Nit: consistent case in assert messages. |
What does this comment refer to?