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

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.

>From 635791b1905a471d8bd2f9ee8607b25d4bb10241 Mon Sep 17 00:00:00 2001
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Sun, 12 May 2024 01:03:56 -0400
Subject: [PATCH] [clang] Don't assume location of compiler-rt

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.
---
 clang/lib/Driver/ToolChains/OpenBSD.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 =

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to