[PATCH] D109051: Use Component in OpenBSD::getCompilerRT to find libraries

Greg Steuck via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 1 02:56:47 PDT 2021


blackgnezdo created this revision.
blackgnezdo added a reviewer: brad.
Herald added a subscriber: krytarowski.
blackgnezdo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

OpenBSD with this change would use this name for ASan:
/usr/lib/clang/11.1.0/lib/libclang_rt.asan.a

Already submitted to OpenBSD repository.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109051

Files:
  clang/lib/Driver/ToolChains/OpenBSD.cpp


Index: clang/lib/Driver/ToolChains/OpenBSD.cpp
===================================================================
--- clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -302,9 +302,17 @@
 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109051.369893.patch
Type: text/x-patch
Size: 1032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210901/21570220/attachment.bin>


More information about the cfe-commits mailing list