Skip to content

Commit 2c5d6df

Browse files
committed
[Hexagon] Make lld be the default linker for linux/musl
When the target is hexagon-unknown-linux-musl select lld as the default linker. Differential Revision: https://reviews.llvm.org/D77498
1 parent 8a42bf2 commit 2c5d6df

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

clang/lib/Driver/ToolChains/Hexagon.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
8181
const llvm::opt::ArgList &DriverArgs,
8282
llvm::opt::ArgStringList &CC1Args) const override;
8383

84-
const char *getDefaultLinker() const override { return "hexagon-link"; }
84+
const char *getDefaultLinker() const override {
85+
return getTriple().isMusl() ? "ld.lld" : "hexagon-link";
86+
}
8587

8688
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
8789

clang/test/Driver/hexagon-toolchain-elf.c

+12
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,15 @@
674674
// RUN: | FileCheck -check-prefix=CHECK090 %s
675675
// CHECK090-NOT: -fno-use-init-array
676676
// -----------------------------------------------------------------------------
677+
// Check default linker for musl
678+
// -----------------------------------------------------------------------------
679+
// RUN: %clang -### -target hexagon-unknown-linux-musl %s 2>&1 \
680+
// RUN: | FileCheck -check-prefix=CHECK091 %s
681+
// CHECK091: ld.lld
682+
// -----------------------------------------------------------------------------
683+
// Check default linker for elf
684+
// -----------------------------------------------------------------------------
685+
// RUN: %clang -### -target hexagon-unknown-elf %s 2>&1 \
686+
// RUN: | FileCheck -check-prefix=CHECK092 %s
687+
// CHECK092: hexagon-link
688+
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)