Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1557,7 +1557,10 @@ static const char *const ARMLibDirs[] = {"/lib"}; static const char *const ARMTriples[] = {"arm-linux-gnueabi", "arm-linux-androideabi"}; + // arm*-hardfloat-* triples are used by Gentoo static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", + "armv6j-hardfloat-linux-gnueabi", + "armv7a-hardfloat-linux-gnueabi", "armv7hl-redhat-linux-gnueabi"}; static const char *const ARMebLibDirs[] = {"/lib"}; static const char *const ARMebTriples[] = {"armeb-linux-gnueabi", @@ -1565,6 +1568,10 @@ static const char *const ARMebHFTriples[] = { "armeb-linux-gnueabihf", "armebv7hl-redhat-linux-gnueabi"}; + static const char *const ARMHFMuslTriples[] = { + "armv6j-hardfloat-linux-musleabi", + "armv7a-hardfloat-linux-musleabi"}; + static const char *const X86_64LibDirs[] = {"/lib64", "/lib"}; static const char *const X86_64Triples[] = { "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", @@ -1664,6 +1671,8 @@ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs)); if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) { TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples)); + } else if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) { + TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples)); } else { TripleAliases.append(begin(ARMTriples), end(ARMTriples)); } Index: test/Driver/linux-ld.c =================================================================== --- test/Driver/linux-ld.c +++ test/Driver/linux-ld.c @@ -1002,6 +1002,32 @@ // CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9{{/|\\\\}}crtend.o" // CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu{{/|\\\\}}crtn.o" // +// Check Gentoo Linux with GCC installed using arm*-hardfloat-linux-gnu* triples. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7a-hardfloat-linux-gnueabi --rtlib=platform \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_armhf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-GENTOO-ARMHF %s +// CHECK-LD-GENTOO-ARMHF-NOT: warning: +// CHECK-LD-GENTOO-ARMHF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-GENTOO-ARMHF: "--eh-frame-hdr" +// CHECK-LD-GENTOO-ARMHF: "-m" "armelf_linux_eabi" +// CHECK-LD-GENTOO-ARMHF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3" +// CHECK-LD-GENTOO-ARMHF: "{{.*}}/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/crtbegin.o" +// CHECK-LD-GENTOO-ARMHF: "-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3" +// CHECK-LD-GENTOO-ARMHF: "-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/../../../../armv7a-hardfloat-linux-gnueabi/lib" +// CHECK-LD-GENTOO-ARMHF: "-L[[SYSROOT]]/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.9.3/../../.." +// CHECK-LD-GENTOO-ARMHF: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" +// CHECK-LD-GENTOO-ARMHF: "-lc" +// CHECK-LD-GENTOO-ARMHF: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" +// +// Check whether the standard ARM triples can find Gentoo gcc. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7a-unknown-linux-gnueabihf --rtlib=platform \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_armhf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-GENTOO-ARMHF %s +// // Test linker invocation on Android. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi -rtlib=platform \