From: gnezdo Date: Wed, 1 Sep 2021 09:34:53 +0000 (+0000) Subject: llvm: Use Component in OpenBSD::getCompilerRT to find libraries X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0b99cc4d5d8311a90145e8f4c6ae23275c275c52;p=openbsd llvm: Use Component in OpenBSD::getCompilerRT to find libraries Clang uses runtime libraries for some advanced features like sanitizers. Different systems have different preferences about file placement. OpenBSD with this change would use this name for ASan: /usr/lib/clang/11.1.0/lib/libclang_rt.asan.a So far, no libraries are shipped, only their eventual location is chosen. Discussed with deraadt@ and kettenis@, OK mortimer@ --- diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/OpenBSD.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/OpenBSD.cpp index 5333cecd285..41df6d9a8d7 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/OpenBSD.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/OpenBSD.cpp @@ -300,9 +300,17 @@ void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args, std::string OpenBSD::getCompilerRT(const ArgList &Args, StringRef Component, FileType Type) const { - SmallString<128> Path(getDriver().SysRoot); - llvm::sys::path::append(Path, "/usr/lib/libcompiler_rt.a"); - return std::string(Path.str()); + if (Component == "builtins") { + SmallString<128> Path(getDriver().SysRoot); + llvm::sys::path::append(Path, "/usr/lib/libcompiler_rt.a"); + return std::string(Path.str()); + } else { + SmallString<128> P(getDriver().ResourceDir); + std::string CRTBasename = + getCompilerRTBasename(Args, Component, Type, /*AddArch=*/false); + llvm::sys::path::append(P, "lib", CRTBasename); + return std::string(P.str()); + } } Tool *OpenBSD::buildAssembler() const {