You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
862 B

diff --git a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp
index 2ad4509..4d0b060 100644
--- a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~
+++ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -483,7 +483,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (OnlyLibstdcxxStatic)
CmdArgs.push_back("-Bdynamic");
}
- CmdArgs.push_back("-lm");
}
// Silence warnings when linking C code with a C++ '-stdlib' argument.
Args.ClaimAllArgs(options::OPT_stdlib_EQ);
@@ -513,6 +512,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+ if (D.CCCIsCXX())
+ CmdArgs.push_back("-lm");
+
if (WantPthread && !isAndroid)
CmdArgs.push_back("-lpthread");