diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-21 17:51:23 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-21 17:51:23 +0900 |
| commit | 54aae9d72a12ae8af93ba35d00a3817e3105dcce (patch) | |
| tree | fcd8a264d970c0060c9ee5070e845fe446b6fce2 /internal/rosa/package/llvm/path-system-libraries.patch | |
| parent | 58646f8ea56d2b2093891e5265225e0c100104f6 (diff) | |
internal/rosa/package: migrate llvm patches
LLVM itself is unlikely to ever be migrated due to complexity of the bootstrap, so migrate patches instead.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/package/llvm/path-system-libraries.patch')
| -rw-r--r-- | internal/rosa/package/llvm/path-system-libraries.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/internal/rosa/package/llvm/path-system-libraries.patch b/internal/rosa/package/llvm/path-system-libraries.patch new file mode 100644 index 00000000..fbe46def --- /dev/null +++ b/internal/rosa/package/llvm/path-system-libraries.patch @@ -0,0 +1,88 @@ +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index cb6a9b242421..b8d31690d1af 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2314,6 +2314,10 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + Prefixes.push_back("/opt/rh/devtoolset-2/root/usr"); + } + ++ if (TargetTriple.getVendor() == llvm::Triple::Rosa) { ++ Prefixes.push_back(concat(SysRoot, "/system")); ++ } ++ + // Fall back to /usr which is used by most non-Solaris systems. + Prefixes.push_back(concat(SysRoot, "/usr")); + } +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index d525b417b4ea..2b93f401733e 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -302,6 +302,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + const bool IsHexagon = Arch == llvm::Triple::hexagon; + const bool IsRISCV = Triple.isRISCV(); + const bool IsCSKY = Triple.isCSKY(); ++ const bool IsRosa = Triple.getVendor() == llvm::Triple::Rosa; + + if (IsCSKY && !SelectedMultilibs.empty()) + SysRoot = SysRoot + SelectedMultilibs.back().osSuffix(); +@@ -341,8 +342,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + // used. We need add both libo32 and /lib. + if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel) { + Generic_GCC::AddMultilibPaths(D, SysRoot, "libo32", MultiarchTriple, Paths); +- addPathIfExists(D, concat(SysRoot, "/libo32"), Paths); +- addPathIfExists(D, concat(SysRoot, "/usr/libo32"), Paths); ++ if (!IsRosa) { ++ addPathIfExists(D, concat(SysRoot, "/libo32"), Paths); ++ addPathIfExists(D, concat(SysRoot, "/usr/libo32"), Paths); ++ } else { ++ addPathIfExists(D, concat(SysRoot, "/system/libo32"), Paths); ++ } + } + Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths); + +@@ -360,18 +365,30 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + Paths); + } + +- addPathIfExists(D, concat(SysRoot, "/usr/lib", MultiarchTriple), Paths); +- addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir), Paths); ++ if (!IsRosa) { ++ addPathIfExists(D, concat(SysRoot, "/usr/lib", MultiarchTriple), Paths); ++ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir), Paths); ++ } else { ++ addPathIfExists(D, concat(SysRoot, "/system/lib", MultiarchTriple), Paths); ++ addPathIfExists(D, concat(SysRoot, "/system", OSLibDir), Paths); ++ } + if (IsRISCV) { + StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); + addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths); +- addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths); ++ if (!IsRosa) ++ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths); ++ else ++ addPathIfExists(D, concat(SysRoot, "/system", OSLibDir, ABIName), Paths); + } + + Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths); + +- addPathIfExists(D, concat(SysRoot, "/lib"), Paths); +- addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths); ++ if (!IsRosa) { ++ addPathIfExists(D, concat(SysRoot, "/lib"), Paths); ++ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths); ++ } else { ++ addPathIfExists(D, concat(SysRoot, "/system/lib"), Paths); ++ } + } + + ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const { +@@ -572,6 +589,9 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; + } + if (Triple.isMusl()) { ++ if (Triple.getVendor() == llvm::Triple::Rosa) ++ return "/system/bin/linker"; ++ + std::string ArchName; + bool IsArm = false; + |
