OLD | NEW |
1 //===--- Tools.cpp - Tools Implementations --------------------------------===// | 1 //===--- Tools.cpp - Tools Implementations --------------------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #include "Tools.h" | 10 #include "Tools.h" |
(...skipping 7699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7710 CmdArgs.push_back("-Bdynamic"); | 7710 CmdArgs.push_back("-Bdynamic"); |
7711 CmdArgs.push_back("-lm"); | 7711 CmdArgs.push_back("-lm"); |
7712 } | 7712 } |
7713 | 7713 |
7714 if (!Args.hasArg(options::OPT_nostdlib)) { | 7714 if (!Args.hasArg(options::OPT_nostdlib)) { |
7715 if (!Args.hasArg(options::OPT_nodefaultlibs)) { | 7715 if (!Args.hasArg(options::OPT_nodefaultlibs)) { |
7716 // Always use groups, since it has no effect on dynamic libraries. | 7716 // Always use groups, since it has no effect on dynamic libraries. |
7717 CmdArgs.push_back("--start-group"); | 7717 CmdArgs.push_back("--start-group"); |
7718 CmdArgs.push_back("-lc"); | 7718 CmdArgs.push_back("-lc"); |
7719 // libc++ and PPAPI programs always require libpthread, so just always | 7719 // libc++ and PPAPI programs always require libpthread, so just always |
7720 // include it in the group. | 7720 // include it in the group for C++. |
7721 Args.ClaimAllArgs(options::OPT_pthread); | 7721 if (Args.hasArg(options::OPT_pthread) || |
7722 Args.ClaimAllArgs(options::OPT_pthreads); | 7722 Args.hasArg(options::OPT_pthreads) || |
7723 CmdArgs.push_back("-lpthread"); | 7723 D.CCCIsCXX()) { |
| 7724 CmdArgs.push_back("-lpthread"); |
| 7725 } |
7724 | 7726 |
7725 CmdArgs.push_back("-lgcc"); | 7727 CmdArgs.push_back("-lgcc"); |
7726 CmdArgs.push_back("--as-needed"); | 7728 CmdArgs.push_back("--as-needed"); |
7727 if (IsStatic) | 7729 if (IsStatic) |
7728 CmdArgs.push_back("-lgcc_eh"); | 7730 CmdArgs.push_back("-lgcc_eh"); |
7729 else | 7731 else |
7730 CmdArgs.push_back("-lgcc_s"); | 7732 CmdArgs.push_back("-lgcc_s"); |
7731 CmdArgs.push_back("--no-as-needed"); | 7733 CmdArgs.push_back("--no-as-needed"); |
7732 CmdArgs.push_back("--end-group"); | 7734 CmdArgs.push_back("--end-group"); |
7733 } | 7735 } |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8495 CmdArgs.push_back("-lmsvcrt"); | 8497 CmdArgs.push_back("-lmsvcrt"); |
8496 AddRunTimeLibs(TC, D, CmdArgs, Args); | 8498 AddRunTimeLibs(TC, D, CmdArgs, Args); |
8497 } | 8499 } |
8498 } | 8500 } |
8499 | 8501 |
8500 const std::string Linker = TC.GetProgramPath("ld"); | 8502 const std::string Linker = TC.GetProgramPath("ld"); |
8501 Exec = Args.MakeArgString(Linker); | 8503 Exec = Args.MakeArgString(Linker); |
8502 | 8504 |
8503 C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs)); | 8505 C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs)); |
8504 } | 8506 } |
8505 | |
OLD | NEW |