diff options
| author | Dimitry Andric <dimitry@andric.com> | 2016-02-14 16:08:20 +0000 |
|---|---|---|
| committer | Dimitry Andric <dimitry@andric.com> | 2016-02-14 16:08:20 +0000 |
| commit | 6090739f8d92df046b4e0d64add0604477e8cb0a (patch) | |
| tree | 7abbd66999d1fe84cb70d862c5078b0ce097857f /clang/lib/Driver/ToolChains.cpp | |
| parent | 24c2a9a4e4d3ffa8ebecf85541857c58d734362d (diff) | |
| download | bcm5719-llvm-6090739f8d92df046b4e0d64add0604477e8cb0a.tar.gz bcm5719-llvm-6090739f8d92df046b4e0d64add0604477e8cb0a.zip | |
As reported in https://llvm.org/bugs/show_bug.cgi?id=25496, on FreeBSD,
C++ programs compiled for profiling (using `-pg`) should be linked with
`-lc++_p` (or `-lstdc++_p`, depending on the `-stdlib=` setting), not
with the regular C++ libraries.
Add a `FreeBSD::AddCXXStdlibLibArgs()` override to handle this, and add
a test case for it. While here, extend the test case for the proper
passing of -lm and -lm_p.
Reviewers: compnerd, davide, dws, emaste
Reviewed By: compnerd
Differential Revision: http://reviews.llvm.org/D16264
llvm-svn: 260851
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index cb5e7329cd9..ae24e4731b7 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -3128,6 +3128,22 @@ void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, } } +void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args, + ArgStringList &CmdArgs) const { + CXXStdlibType Type = GetCXXStdlibType(Args); + bool Profiling = Args.hasArg(options::OPT_pg); + + switch (Type) { + case ToolChain::CST_Libcxx: + CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++"); + break; + + case ToolChain::CST_Libstdcxx: + CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++"); + break; + } +} + Tool *FreeBSD::buildAssembler() const { return new tools::freebsd::Assembler(*this); } |

