if (Triple.isAndroid())
return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
+ else if (Triple.getEnvironment() == llvm::Triple::Musl)
+ return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
std::string LibDir;
std::string Loader;
// CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ARMV7EB: "--be8"
// CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
+
+// Check dynamic-linker for musl-libc
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=i386-pc-linux-musl \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL32 %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-pc-linux-musl \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL64 %s
+// CHECK-MUSL32: "-dynamic-linker" "/lib/ld-musl-i386.so.1"
+// CHECK-MUSL64: "-dynamic-linker" "/lib/ld-musl-x86_64.so.1"