[llvm-branch-commits] [clang] 48c1364 - [clang] Don't assume location of compiler-rt for OpenBSD (#92183)

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 17 16:27:21 PDT 2024


Author: John Ericson
Date: 2024-05-17T16:26:37-07:00
New Revision: 48c1364200b5649dda2f9ccbe382b0bd908b99de

URL: https://github.com/llvm/llvm-project/commit/48c1364200b5649dda2f9ccbe382b0bd908b99de
DIFF: https://github.com/llvm/llvm-project/commit/48c1364200b5649dda2f9ccbe382b0bd908b99de.diff

LOG: [clang] Don't assume location of compiler-rt for OpenBSD (#92183)

If the `/usr/lib/...` path where compiler-rt is conventionally installed
on OpenBSD does not exist, fall back to the regular logic to find it.

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

(cherry picked from commit be10746f3a4381456eb5082a968766201c17ab5d)

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/OpenBSD.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e6844..00b6c520fcdd7 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -371,7 +371,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 =


        


More information about the llvm-branch-commits mailing list