Skip to content

Commit ae48c2a

Browse files
committed
[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
1 parent d23d90c commit ae48c2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,16 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
385385
const llvm::Triple::ArchType Arch = ToolChain.getArch();
386386
const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily();
387387
const bool isAndroid = ToolChain.getTriple().isAndroid();
388+
const bool isMusl = ToolChain.getTriple().isMusl();
388389
const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
389390
const bool IsVE = ToolChain.getTriple().isVE();
390391
const bool IsPIE = getPIE(Args, ToolChain);
391392
const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
392393
const bool IsStatic = getStatic(Args);
393394
const bool HasCRTBeginEndFiles =
394-
ToolChain.getTriple().hasEnvironment() ||
395-
(ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
395+
!isMusl && (ToolChain.getTriple().hasEnvironment() ||
396+
(ToolChain.getTriple().getVendor()
397+
!= llvm::Triple::MipsTechnologies));
396398

397399
ArgStringList CmdArgs;
398400

0 commit comments

Comments
 (0)