https://github.com/al45tair created https://github.com/llvm/llvm-project/pull/85089
musl doesn't supply crtbegin/crtend objects, so we don't want to try to link them there. rdar://123436174 >From 8bdd6627e21eaddedfff208eebaa46f1eeb81674 Mon Sep 17 00:00:00 2001 From: Alastair Houghton <ahough...@apple.com> Date: Thu, 22 Feb 2024 11:36:57 +0000 Subject: [PATCH] [Clang] Don't use crtbegin/crtend when building for musl. musl doesn't supply crtbegin/crtend objects, so we don't want to try to link them there. rdar://123436174 --- clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index a9c9d2475809d7..7b7d9194a773ec 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -371,13 +371,15 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple::ArchType Arch = ToolChain.getArch(); const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily(); const bool isAndroid = ToolChain.getTriple().isAndroid(); + const bool isMusl = ToolChain.getTriple().isMusl(); const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU(); const bool IsVE = ToolChain.getTriple().isVE(); const bool IsStaticPIE = getStaticPIE(Args, ToolChain); const bool IsStatic = getStatic(Args); const bool HasCRTBeginEndFiles = - ToolChain.getTriple().hasEnvironment() || - (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies); + !isMusl && (ToolChain.getTriple().hasEnvironment() || + (ToolChain.getTriple().getVendor() + != llvm::Triple::MipsTechnologies)); ArgStringList CmdArgs; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits