Skip to content

Conversation

@llvmbot
Copy link
Member

@llvmbot llvmbot commented May 15, 2024

Backport be10746

Requested by: @Ericson2314

@llvmbot llvmbot added this to the LLVM 18.X Release milestone May 15, 2024
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels May 15, 2024
@llvmbot
Copy link
Member Author

llvmbot commented May 15, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: None (llvmbot)

Changes

Backport be10746

Requested by: @Ericson2314


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

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/OpenBSD.cpp (+2-1)
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 =

@Ericson2314
Copy link
Member

Ericson2314 commented May 15, 2024

(I read https://llvm.org/docs/HowToReleaseLLVM.html#release-patch-rules and believe it qualifies. It's a bug fix for me and people like me, and a no-op for everyone else.)

@tstellar tstellar requested a review from brad0 May 15, 2024 19:08
@tstellar
Copy link
Collaborator

@brad0 What do you think about backporting this?

@tstellar
Copy link
Collaborator

cc @epsilon-0

@Ericson2314
Copy link
Member

(FWIW #92601 is somewhat a companion backport.)

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 be10746)
@tstellar tstellar merged commit 48c1364 into llvm:release/18.x May 17, 2024
@epsilon-0
Copy link

Late to the party, but it looks good from my side :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

Development

Successfully merging this pull request may close these issues.

5 participants