Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1538,6 +1538,7 @@ def pthreads : Flag<["-"], "pthreads">; def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>, HelpText<"Support POSIX threads in generated code">; +def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>; def p : Flag<["-"], "p">; def pie : Flag<["-"], "pie">; def read__only__relocs : Separate<["-"], "read_only_relocs">; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -9008,7 +9008,8 @@ if (Args.hasArg(options::OPT_pg)) CmdArgs.push_back("-lgmon"); - if (Args.hasArg(options::OPT_pthread)) + if (Args.hasArg(options::OPT_pthread) && + !Args.hasArg(options::OPT_no_pthread)) CmdArgs.push_back("-lpthread"); // add system libraries