https://github.com/mojyack created
https://github.com/llvm/llvm-project/pull/196322
Add `mips{,el,64,64el}-unknown-elf` to the set of triples claimed by the
BareMetal toolchain, mirroring the existing handling for
`riscv{32,64}-unknown-elf`, `x86{,_64}-unknown-elf`, and
`powerpc*-unknown-eabi`.
This is required for creating RockBox LLVM port (see
https://gerrit.rockbox.org/r/c/rockbox/+/7466).
>From fbab230dacc821ba07f11441f8e26447973e5207 Mon Sep 17 00:00:00 2001
From: mojyack <[email protected]>
Date: Thu, 7 May 2026 22:54:07 +0900
Subject: [PATCH] [Driver] Handle mips*-*-none-elf triples
Route MIPS bare-metal triples through the BareMetal toolchain so clang
invokes ld.lld directly instead of delegating to $target-gcc.
---
clang/lib/Driver/ToolChains/BareMetal.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp
b/clang/lib/Driver/ToolChains/BareMetal.cpp
index 3ba592666647a..5f489a68b36fc 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -55,6 +55,12 @@ static bool isX86BareMetal(const llvm::Triple &Triple) {
Triple.getEnvironmentName() == "elf";
}
+/// Is the triple mips{,el,64,64el}-*-none-elf?
+static bool isMIPSBareMetal(const llvm::Triple &Triple) {
+ return Triple.isMIPS() && Triple.getOS() == llvm::Triple::UnknownOS &&
+ Triple.getEnvironmentName() == "elf";
+}
+
static bool findRISCVMultilibs(const Driver &D,
const llvm::Triple &TargetTriple,
const ArgList &Args, DetectedMultilibs &Result)
{
@@ -281,7 +287,8 @@ void BareMetal::findMultilibs(const Driver &D, const
llvm::Triple &Triple,
bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
return arm::isARMEABIBareMetal(Triple) ||
aarch64::isAArch64BareMetal(Triple) || isRISCVBareMetal(Triple) ||
- isPPCBareMetal(Triple) || isX86BareMetal(Triple);
+ isPPCBareMetal(Triple) || isX86BareMetal(Triple) ||
+ isMIPSBareMetal(Triple);
}
Tool *BareMetal::buildLinker() const {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits