Index: clang/lib/Driver/ToolChains/Hexagon.h =================================================================== --- clang/lib/Driver/ToolChains/Hexagon.h +++ clang/lib/Driver/ToolChains/Hexagon.h @@ -81,7 +81,9 @@ const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - const char *getDefaultLinker() const override { return "hexagon-link"; } + const char *getDefaultLinker() const override { + return getTriple().isMusl() ? "ld.lld" : "hexagon-link"; + } CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; Index: clang/test/Driver/hexagon-toolchain-elf.c =================================================================== --- clang/test/Driver/hexagon-toolchain-elf.c +++ clang/test/Driver/hexagon-toolchain-elf.c @@ -674,3 +674,15 @@ // RUN: | FileCheck -check-prefix=CHECK090 %s // CHECK090-NOT: -fno-use-init-array // ----------------------------------------------------------------------------- +// Check default linker for musl +// ----------------------------------------------------------------------------- +// RUN: %clang -### -target hexagon-unknown-linux-musl %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK091 %s +// CHECK091: ld.lld +// ----------------------------------------------------------------------------- +// Check default linker for elf +// ----------------------------------------------------------------------------- +// RUN: %clang -### -target hexagon-unknown-elf %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK092 %s +// CHECK092: hexagon-link +// -----------------------------------------------------------------------------