Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2116,6 +2116,11 @@ break; } + // Add generic features. + if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign, + false)) + Features.push_back("+force-align-stack"); + // Find the last of each feature. llvm::StringMap LastOpt; for (unsigned I = 0, N = Features.size(); I < N; ++I) { @@ -4225,11 +4230,6 @@ } // Translate -mstackrealign - if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign, - false)) { - CmdArgs.push_back("-backend-option"); - CmdArgs.push_back("-force-align-stack"); - } if (!Args.hasFlag(options::OPT_mno_stackrealign, options::OPT_mstackrealign, false)) { CmdArgs.push_back(Args.MakeArgString("-mstackrealign")); Index: test/Driver/stackrealign.c =================================================================== --- test/Driver/stackrealign.c +++ test/Driver/stackrealign.c @@ -1,12 +1,12 @@ // RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NORMAL -// NORMAL-NOT: -force-align-stack +// NORMAL-NOT: "-target-feature" "+force-align-stack" // NORMAL: -mstackrealign // RUN: %clang -### -mstackrealign %s 2>&1 | FileCheck %s -check-prefix=MREALIGN -// MREALIGN: -force-align-stack +// MREALIGN: "-target-feature" "+force-align-stack" // MREALIGN: -mstackrealign // RUN: %clang -### -mno-stackrealign %s 2>&1 | \ // RUN: FileCheck %s -check-prefix=MNOREALIGN -// MNOREALIGN-NOT: -force-align-stack +// MNOREALIGN-NOT: "-target-feature" "+force-align-stack" // MNOREALIGN-NOT: -mstackrealign