aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/package/llvm/path-system-libraries.patch
blob: fbe46def0c40eaf6c0493998dbcc4bca2aefbf5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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;