Attention is currently required from: Martin L Roth.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84032?usp=email )
Change subject: util/crossgcc: Patch clang to enable linking x86 bare metal targets ......................................................................
util/crossgcc: Patch clang to enable linking x86 bare metal targets
This allows clang to link x86 bare metal targets.
Change-Id: I943215c8714e392e52ea35667f2bf21e517c4255 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- A util/crossgcc/patches/clang-18.1.6.src_x86_baremetal.patch 1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/84032/1
diff --git a/util/crossgcc/patches/clang-18.1.6.src_x86_baremetal.patch b/util/crossgcc/patches/clang-18.1.6.src_x86_baremetal.patch new file mode 100644 index 0000000..61c608c --- /dev/null +++ b/util/crossgcc/patches/clang-18.1.6.src_x86_baremetal.patch @@ -0,0 +1,29 @@ +diff --git a/lib/Driver/ToolChains/BareMetal.cpp b/lib/Driver/ToolChains/BareMetal.cpp +index 852e0442..eb84a785 100644 +--- a/lib/Driver/ToolChains/BareMetal.cpp ++++ b/lib/Driver/ToolChains/BareMetal.cpp +@@ -169,6 +169,12 @@ static bool isPPCBareMetal(const llvm::Triple &Triple) { + Triple.getEnvironment() == llvm::Triple::EABI; + } + ++/// Is the triple x86_32 or x86_64 -*-none-elf? ++static bool isX86BareMetal(const llvm::Triple &Triple) { ++ return Triple.isX86() && Triple.getOS() == llvm::Triple::UnknownOS && ++ Triple.getEnvironmentName() == "elf"; ++} ++ + static void findMultilibsFromYAML(const ToolChain &TC, const Driver &D, + StringRef MultilibPath, const ArgList &Args, + DetectedMultilibs &Result) { +@@ -234,9 +240,10 @@ void BareMetal::findMultilibs(const Driver &D, const llvm::Triple &Triple, + + bool BareMetal::handlesTarget(const llvm::Triple &Triple) { + return isARMBareMetal(Triple) || isAArch64BareMetal(Triple) || +- isRISCVBareMetal(Triple) || isPPCBareMetal(Triple); ++ isRISCVBareMetal(Triple) || isPPCBareMetal(Triple) || isX86BareMetal(Triple); + } + ++ + Tool *BareMetal::buildLinker() const { + return new tools::baremetal::Linker(*this); + }