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

via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 09:43:59 PDT 2024


Author: John Ericson
Date: 2024-05-15T12:43:55-04:00
New Revision: be10746f3a4381456eb5082a968766201c17ab5d

URL: https://github.com/llvm/llvm-project/commit/be10746f3a4381456eb5082a968766201c17ab5d
DIFF: https://github.com/llvm/llvm-project/commit/be10746f3a4381456eb5082a968766201c17ab5d.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.

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 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 =


        


More information about the cfe-commits mailing list