Index: lib/Driver/ToolChain.cpp =================================================================== --- lib/Driver/ToolChain.cpp +++ lib/Driver/ToolChain.cpp @@ -74,11 +74,6 @@ : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)), CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)), EffectiveTriple() { - if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) - if (!isThreadModelSupported(A->getValue())) - D.Diag(diag::err_drv_invalid_thread_model_for_target) - << A->getValue() << A->getAsString(Args); - std::string CandidateLibPath = getArchSpecificLibPath(); if (getVFS().exists(CandidateLibPath)) getFilePaths().push_back(CandidateLibPath); Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -3254,8 +3254,12 @@ } CmdArgs.push_back("-mthread-model"); - if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) + if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) { + if (!getToolChain().isThreadModelSupported(A->getValue())) + D.Diag(diag::err_drv_invalid_thread_model_for_target) + << A->getValue() << A->getAsString(Args); CmdArgs.push_back(A->getValue()); + } else CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));