forked from rosa/hakurei
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>
This commit is contained in:
88
internal/rosa/package/llvm/path-system-libraries.patch
Normal file
88
internal/rosa/package/llvm/path-system-libraries.patch
Normal file
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user