llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.78k stars 11.9k forks source link

release/18.x: [clang] Don't assume location of compiler-rt for OpenBSD (#92183) #92293

Closed llvmbot closed 5 months ago

llvmbot commented 5 months ago

Backport be10746

Requested by: @Ericson2314

llvmbot commented 5 months ago

@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 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 commented 5 months ago

(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 commented 5 months ago

@brad0 What do you think about backporting this?

tstellar commented 5 months ago

cc @epsilon-0

Ericson2314 commented 5 months ago

(FWIW https://github.com/llvm/llvm-project/pull/92601 is somewhat a companion backport.)

epsilon-0 commented 5 months ago

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