Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp (revision 272991) +++ lib/Basic/Targets.cpp (working copy) @@ -4863,6 +4863,8 @@ case llvm::Triple::Android: case llvm::Triple::GNUEABI: case llvm::Triple::GNUEABIHF: + case llvm::Triple::MuslEABI: + case llvm::Triple::MuslEABIHF: setABI("aapcs-linux"); break; case llvm::Triple::EABIHF: Index: lib/CodeGen/TargetInfo.cpp =================================================================== --- lib/CodeGen/TargetInfo.cpp (revision 272991) +++ lib/CodeGen/TargetInfo.cpp (working copy) @@ -4962,6 +4962,8 @@ case llvm::Triple::EABIHF: case llvm::Triple::GNUEABI: case llvm::Triple::GNUEABIHF: + case llvm::Triple::MuslEABI: + case llvm::Triple::MuslEABIHF: return true; default: return false; @@ -4972,6 +4974,7 @@ switch (getTarget().getTriple().getEnvironment()) { case llvm::Triple::EABIHF: case llvm::Triple::GNUEABIHF: + case llvm::Triple::MuslEABIHF: return true; default: return false; @@ -7922,6 +7925,7 @@ else if (CodeGenOpts.FloatABI == "hard" || (CodeGenOpts.FloatABI != "soft" && (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || + Triple.getEnvironment() == llvm::Triple::MuslEABIHF || Triple.getEnvironment() == llvm::Triple::EABIHF))) Kind = ARMABIInfo::AAPCS_VFP; Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp (revision 272991) +++ lib/Driver/ToolChains.cpp (working copy) @@ -4158,9 +4158,24 @@ 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"; + else if (Triple.isMusl()) { + std::string ArchName; + switch (Arch) { + case llvm::Triple::thumb: + ArchName = "arm"; + break; + case llvm::Triple::thumbeb: + ArchName = "armeb"; + break; + default: + ArchName = Triple.getArchName().str(); + } + if (Triple.getEnvironment() == llvm::Triple::MuslEABIHF) + ArchName += "hf"; + return "/lib/ld-musl-" + ArchName + ".so.1"; + } + std::string LibDir; std::string Loader; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp (revision 272991) +++ lib/Driver/Tools.cpp (working copy) @@ -796,10 +796,12 @@ default: switch (Triple.getEnvironment()) { case llvm::Triple::GNUEABIHF: + case llvm::Triple::MuslEABIHF: case llvm::Triple::EABIHF: ABI = FloatABI::Hard; break; case llvm::Triple::GNUEABI: + case llvm::Triple::MuslEABI: case llvm::Triple::EABI: // EABI is always AAPCS, and if it was not marked 'hard', it's softfp ABI = FloatABI::SoftFP; @@ -1045,6 +1047,8 @@ case llvm::Triple::Android: case llvm::Triple::GNUEABI: case llvm::Triple::GNUEABIHF: + case llvm::Triple::MuslEABI: + case llvm::Triple::MuslEABIHF: ABIName = "aapcs-linux"; break; case llvm::Triple::EABIHF: Index: test/Driver/arm-abi.c =================================================================== --- test/Driver/arm-abi.c (revision 272991) +++ test/Driver/arm-abi.c (working copy) @@ -28,7 +28,7 @@ // RUN: %clang -target arm--netbsd-eabihf %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS %s -// Otherwise, ABI is celected based on environment +// Otherwise, ABI is selected based on environment // RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s // RUN: %clang -target arm---gnueabi %s -### -o %t.o 2>&1 \ @@ -35,6 +35,10 @@ // RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s // RUN: %clang -target arm---gnueabihf %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s +// RUN: %clang -target arm---musleabi %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s +// RUN: %clang -target arm---musleabihf %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s // RUN: %clang -target arm---eabi %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-AAPCS %s // RUN: %clang -target arm---eabihf %s -### -o %t.o 2>&1 \ Index: test/Driver/linux-ld.c =================================================================== --- test/Driver/linux-ld.c (revision 272991) +++ test/Driver/linux-ld.c (working copy) @@ -1597,11 +1597,47 @@ // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=powerpc64-pc-linux-musl \ // RUN: | FileCheck --check-prefix=CHECK-MUSL-PPC64 %s -// CHECK-MUSL-X86: "-dynamic-linker" "/lib/ld-musl-i386.so.1" -// CHECK-MUSL-X86_64: "-dynamic-linker" "/lib/ld-musl-x86_64.so.1" -// CHECK-MUSL-MIPS: "-dynamic-linker" "/lib/ld-musl-mips.so.1" -// CHECK-MUSL-MIPSEL: "-dynamic-linker" "/lib/ld-musl-mipsel.so.1" -// CHECK-MUSL-MIPS64: "-dynamic-linker" "/lib/ld-musl-mips64.so.1" -// CHECK-MUSL-MIPS64EL: "-dynamic-linker" "/lib/ld-musl-mips64el.so.1" -// CHECK-MUSL-PPC: "-dynamic-linker" "/lib/ld-musl-powerpc.so.1" -// CHECK-MUSL-PPC64: "-dynamic-linker" "/lib/ld-musl-powerpc64.so.1" +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=thumb-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARM %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=thumb-pc-linux-musleabihf \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=thumbeb-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=thumbeb-pc-linux-musleabihf \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=arm-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARM %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=arm-pc-linux-musleabihf \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armeb-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armeb-pc-linux-musleabihf \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-AARCH64 %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64_be-pc-linux-musleabi \ +// RUN: | FileCheck --check-prefix=CHECK-MUSL-AARCH64_BE %s +// CHECK-MUSL-X86: "-dynamic-linker" "/lib/ld-musl-i386.so.1" +// CHECK-MUSL-X86_64: "-dynamic-linker" "/lib/ld-musl-x86_64.so.1" +// CHECK-MUSL-MIPS: "-dynamic-linker" "/lib/ld-musl-mips.so.1" +// CHECK-MUSL-MIPSEL: "-dynamic-linker" "/lib/ld-musl-mipsel.so.1" +// CHECK-MUSL-MIPS64: "-dynamic-linker" "/lib/ld-musl-mips64.so.1" +// CHECK-MUSL-MIPS64EL: "-dynamic-linker" "/lib/ld-musl-mips64el.so.1" +// CHECK-MUSL-PPC: "-dynamic-linker" "/lib/ld-musl-powerpc.so.1" +// CHECK-MUSL-PPC64: "-dynamic-linker" "/lib/ld-musl-powerpc64.so.1" +// CHECK-MUSL-ARM: "-dynamic-linker" "/lib/ld-musl-arm.so.1" +// CHECK-MUSL-ARMHF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1" +// CHECK-MUSL-ARMEB: "-dynamic-linker" "/lib/ld-musl-armeb.so.1" +// CHECK-MUSL-ARMEBHF: "-dynamic-linker" "/lib/ld-musl-armebhf.so.1" +// CHECK-MUSL-AARCH64: "-dynamic-linker" "/lib/ld-musl-aarch64.so.1" +// CHECK-MUSL-AARCH64_BE: "-dynamic-linker" "/lib/ld-musl-aarch64_be.so.1"