https://github.com/yamt created https://github.com/llvm/llvm-project/pull/187923
Note: as system /usr/bin/ld is not threaded, LLVMgold.so fails if it attempts to create threads. i couldn't find a way to suppress the use of threads. -fuse-ld=lld works. >From 9efdd0ba0f2b2ff8b88164534f9b1c1dc6cad04d Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi <[email protected]> Date: Sun, 22 Mar 2026 06:18:14 +0000 Subject: [PATCH] [Driver] Add LTO support for NetBSD Note: as system /usr/bin/ld is not threaded, LLVMgold.so fails if it attempts to create threads. i couldn't find a way to suppress the use of threads. -fuse-ld=lld works. --- clang/lib/Driver/ToolChains/NetBSD.cpp | 6 ++++++ clang/lib/Driver/ToolChains/NetBSD.h | 1 + 2 files changed, 7 insertions(+) diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp index ea722b59853d6..56a42710106fe 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.cpp +++ b/clang/lib/Driver/ToolChains/NetBSD.cpp @@ -274,6 +274,10 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_s, options::OPT_t}); ToolChain.AddFilePathLibArgs(Args, CmdArgs); + if (D.isUsingLTO()) + addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs, + D.getLTOMode() == LTOK_Thin); + bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); @@ -437,6 +441,8 @@ Tool *NetBSD::buildAssembler() const { Tool *NetBSD::buildLinker() const { return new tools::netbsd::Linker(*this); } +bool NetBSD::HasNativeLLVMSupport() const { return true; } + ToolChain::CXXStdlibType NetBSD::GetDefaultCXXStdlibType() const { switch (getArch()) { case llvm::Triple::aarch64: diff --git a/clang/lib/Driver/ToolChains/NetBSD.h b/clang/lib/Driver/ToolChains/NetBSD.h index 96303acaa0099..45848e06abef5 100644 --- a/clang/lib/Driver/ToolChains/NetBSD.h +++ b/clang/lib/Driver/ToolChains/NetBSD.h @@ -52,6 +52,7 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { public: NetBSD(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); + bool HasNativeLLVMSupport() const override; bool IsMathErrnoDefault() const override { return false; } bool IsObjCNonFragileABIDefault() const override { return true; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
