Skip to content

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented May 14, 2024

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.

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.
@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 14, 2024
@llvmbot
Copy link
Member

llvmbot commented May 14, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: John Ericson (Ericson2314)

Changes

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

@epsilon-0
Copy link

Looks good - [email protected]

@Ericson2314
Copy link
Member Author

This is a very simple thing. I am quite sure it is fine from an LLVM perspective; I wanted to make sure it was fine from a BSD perspective, and @epsilon-0 confirmed it (thank you!). Will thus merge shortly.

@Ericson2314 Ericson2314 changed the title [clang] Don't assume location of compiler-rt [clang] Don't assume location of compiler-rt for OpenBSD May 15, 2024
@Ericson2314 Ericson2314 merged commit be10746 into llvm:main May 15, 2024
@Ericson2314 Ericson2314 deleted the clang-openbsd-compiler-rt branch May 15, 2024 16:43
@Ericson2314
Copy link
Member Author

/cherry-pick be10746

@llvmbot
Copy link
Member

llvmbot commented May 15, 2024

/cherry-pick be10746

Error: Command failed due to missing milestone.

@Ericson2314 Ericson2314 added this to the LLVM 18.X Release milestone May 15, 2024
@Ericson2314
Copy link
Member Author

/cherry-pick be10746

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request May 15, 2024
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)
@llvmbot
Copy link
Member

llvmbot commented May 15, 2024

/pull-request #92293

tstellar pushed a commit to llvmbot/llvm-project that referenced this pull request May 17, 2024
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)
Tedlion pushed a commit to Tedlion/llvm-project that referenced this pull request Jun 15, 2025
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)
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.

3 participants