[clang] [Clang][Hexagon] Use --cstdlib flag to choose Picolibc (PR #183257)

Alexey Karyakin via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 09:05:15 PDT 2026


================
@@ -498,27 +516,26 @@ std::string HexagonToolChain::getHexagonTargetDir(
   return std::string(Dir);
 }
 
-SmallString<128> HexagonToolChain::getEffectiveSysRoot() const {
+SmallString<128>
+HexagonToolChain::getEffectiveSysRoot(const ArgList &Args) const {
   const Driver &D = getDriver();
   // The user-specified `--sysroot` always takes precedence.
   if (!D.SysRoot.empty())
     return SmallString<128>(D.SysRoot);
-  // Otherwise, pick a path relative to the install directory. Try a triple
-  // subdirectory first.
+  // Otherwise, pick a path relative to the install directory.
   SmallString<128> Dir(getHexagonTargetDir(D.Dir, D.PrefixDirs));
-  llvm::sys::path::append(Dir, getTriple().normalize());
-  if (getVFS().exists(Dir))
-    return Dir;
-  // Otherwise, fall back to "../target/hexagon".
-  Dir = getHexagonTargetDir(D.Dir, D.PrefixDirs);
-  llvm::sys::path::append(Dir, "hexagon");
+  if (GetCStdlibType(Args) == ToolChain::CST_Picolibc) {
+    llvm::sys::path::append(Dir, "picolibc", getTriple().normalize());
+  } else {
+    llvm::sys::path::append(Dir, "hexagon");
+  }
----------------
quic-akaryaki wrote:

Yes, we need to keep compatibility with dinkumware.

https://github.com/llvm/llvm-project/pull/183257


More information about the cfe-commits mailing list