[clang] [clang] Don't assume location of compiler-rt (PR #92183)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 14:40:15 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: John Ericson (Ericson2314)

<details>
<summary>Changes</summary>

If the `/usr/lib/...` path one expects is not that, fall back to the regular logic.

This is a minimal change to allow OpenBSD cross compilation from a toolchain that doesn't adopt all of OpenBSD's monorepo's conventions.

---
Full diff: https://github.com/llvm/llvm-project/pull/92183.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/OpenBSD.cpp (+2-1) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index e20d9fb1cfc41..3770471bae7c0 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -375,7 +375,8 @@ std::string OpenBSD::getCompilerRT(const ArgList &Args, StringRef Component,
   if (Component == "builtins") {
     SmallString<128> Path(getDriver().SysRoot);
     llvm::sys::path::append(Path, "/usr/lib/libcompiler_rt.a");
-    return std::string(Path);
+    if (getVFS().exists(Path))
+      return std::string(Path);
   }
   SmallString<128> P(getDriver().ResourceDir);
   std::string CRTBasename =

``````````

</details>


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


More information about the cfe-commits mailing list