Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Unified Diff: lib/Driver/Tools.cpp

Issue 964923003: Include -lpthread on the link line automatically only for C++ (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-clang.git@master
Patch Set: review Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/Driver/nacl-direct.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Driver/Tools.cpp
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index e26b93db12af2c6198f1f30743fb23be34fe5606..276d15eb8c344f19e782a867262c556cda2666e5 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7717,10 +7717,12 @@ void nacltools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("--start-group");
CmdArgs.push_back("-lc");
// libc++ and PPAPI programs always require libpthread, so just always
- // include it in the group.
- Args.ClaimAllArgs(options::OPT_pthread);
- Args.ClaimAllArgs(options::OPT_pthreads);
- CmdArgs.push_back("-lpthread");
+ // include it in the group for C++.
+ if (Args.hasArg(options::OPT_pthread) ||
+ Args.hasArg(options::OPT_pthreads) ||
+ D.CCCIsCXX()) {
+ CmdArgs.push_back("-lpthread");
+ }
CmdArgs.push_back("-lgcc");
CmdArgs.push_back("--as-needed");
@@ -8502,4 +8504,3 @@ void CrossWindows::Link::ConstructJob(Compilation &C, const JobAction &JA,
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
}
-
« no previous file with comments | « no previous file | test/Driver/nacl-direct.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698