Index: cfe/trunk/lib/Basic/Targets.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -638,6 +638,9 @@ Opts->Features.clear(); for (const auto &F : Features) Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str()); + // Sort here, so we handle the features in a predictable order. (This matters + // when we're dealing with features that overlap.) + llvm::sort(Opts->Features.begin(), Opts->Features.end()); if (!Target->handleTargetFeatures(Opts->Features, Diags)) return nullptr; Index: cfe/trunk/test/CodeGen/arm-build-attributes.c =================================================================== --- cfe/trunk/test/CodeGen/arm-build-attributes.c +++ cfe/trunk/test/CodeGen/arm-build-attributes.c @@ -0,0 +1,4 @@ +// RUN: %clang --target=arm-none-eabi -x c - -o - -S < %s -mcpu=cortex-a5 -mfpu=vfpv4-d16 | FileCheck %s +// REQUIRES: arm-registered-target +// CHECK: .fpu vfpv4-d16 +void foo() {}