summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Steuck <gnezdo@cvs.openbsd.org>2021-09-01 09:34:54 +0000
committerGreg Steuck <gnezdo@cvs.openbsd.org>2021-09-01 09:34:54 +0000
commit7c181b7b2d881bf0f13f6d8a16c999872f60c331 (patch)
treecf3ea10bfb0ed266f4dd0d699153016f190d3f9e
parentaf50f9722deaaf3cec65d35d1f2a13f4a530a116 (diff)
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@
-rw-r--r--gnu/llvm/clang/lib/Driver/ToolChains/OpenBSD.cpp14
1 files changed, 11 insertions, 3 deletions
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 {