diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2227,6 +2227,8 @@ to the cl flags /MT and /MTd which use the multithread, static version. "dll" and "dll_dbg" correspond to the cl flags /MD and /MDd which use the multithread, dll version.}]>; +def fms_omit_default_lib : Joined<["-"], "fms-omit-default-lib">, + Group, Flags<[NoXarchOption, CoreOption]>; defm delayed_template_parsing : BoolFOption<"delayed-template-parsing", LangOpts<"DelayedTemplateParsing">, DefaultFalse, PosFlag, @@ -6784,7 +6786,7 @@ HelpText<"Volatile loads and stores have acquire and release semantics">; def _SLASH_clang : CLJoined<"clang:">, HelpText<"Pass to the clang driver">, MetaVarName<"">; -def _SLASH_Zl : CLFlag<"Zl">, +def _SLASH_Zl : CLFlag<"Zl">, Alias, HelpText<"Do not let object file auto-link default libraries">; def _SLASH_Yc : CLJoined<"Yc">, diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4499,7 +4499,7 @@ llvm_unreachable("Unexpected option ID."); } - if (Args.hasArg(options::OPT__SLASH_Zl)) { + if (Args.hasArg(options::OPT_fms_omit_default_lib)) { CmdArgs.push_back("-D_VC_NODEFAULTLIB"); } else { CmdArgs.push_back(FlagForCRT.data()); diff --git a/clang/test/Driver/cl-runtime-flags.c b/clang/test/Driver/cl-runtime-flags.c --- a/clang/test/Driver/cl-runtime-flags.c +++ b/clang/test/Driver/cl-runtime-flags.c @@ -97,6 +97,9 @@ // RUN: %clang_cl -### /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s // RUN: %clang_cl -### /MT /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s +// RUN: %clang -### --target=x86_64-windows-msvc -fms-runtime-lib=static \ +// RUN: -fms-omit-default-lib -- %s 2>&1 | FileCheck \ +// RUN: -check-prefix=CHECK-MTZl %s // CHECK-MTZl-NOT: "-D_DEBUG" // CHECK-MTZl: "-D_MT" // CHECK-MTZl-NOT: "-D_DLL"