Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -838,8 +838,12 @@ 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; + // Gentoo puts "hardfloat" in vendor field instead of using *hf + // environment variant. + if (Triple.getVendorName() == "hardfloat") + ABI = FloatABI::Hard; + else // EABI is always AAPCS, and if it was not marked 'hard', it's softfp + ABI = FloatABI::SoftFP; break; case llvm::Triple::Android: ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft; Index: test/Driver/arm-float-abi.c =================================================================== --- test/Driver/arm-float-abi.c +++ test/Driver/arm-float-abi.c @@ -4,3 +4,16 @@ // ARMV7-ERROR: unsupported option '-mfloat-abi=hard' for target 'thumbv7' // NOERROR-NOT: unsupported option + +// Check for correct -mfloat-abi= values for various -targets. +// RUN: %clang %s -target armv7-pc-linux-gnueabi -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SOFTFLOAT %s +// RUN: %clang %s -target armv7-pc-linux-gnueabihf -### 2>&1 \ +// RUN: | FileCheck -check-prefix=HARDFLOAT %s + +// Gentoo uses 'hardfloat' in vendor field. +// RUN: %clang %s -target armv7-hardfloat-linux-gnueabi -### 2>&1 \ +// RUN: | FileCheck -check-prefix=HARDFLOAT %s + +// SOFTFLOAT: "-mfloat-abi" "soft" +// HARDFLOAT: "-mfloat-abi" "hard"