[PATCH] D77498: [Hexagon] Select lld as the default linker for linux-musl target

Sid Manning via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 5 07:27:39 PDT 2020


sidneym created this revision.
sidneym added reviewers: adasgupt, bcain, kparzysz, bcahoon, shankare.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When the target is hexagon-unknown-linux-musl select lld as the default linker.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77498

Files:
  clang/lib/Driver/ToolChains/Hexagon.h
  clang/test/Driver/hexagon-toolchain-elf.c


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
+// -----------------------------------------------------------------------------
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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77498.255159.patch
Type: text/x-patch
Size: 1692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200405/a9bc7c26/attachment.bin>


More information about the cfe-commits mailing list