summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/CommonArgs.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2017-07-25 18:02:57 +0000
committerNico Weber <nicolasweber@gmx.de>2017-07-25 18:02:57 +0000
commit0ee47d92b20019bed49841f93df1b5e4635061fc (patch)
tree67cbe70e812fd13f4bd7dbd5123894c0ce84607b /clang/lib/Driver/ToolChains/CommonArgs.cpp
parentf5ecb5e1b41f73868373bddc9fc0c6ebeecae5b5 (diff)
downloadbcm5719-llvm-0ee47d92b20019bed49841f93df1b5e4635061fc.tar.gz
bcm5719-llvm-0ee47d92b20019bed49841f93df1b5e4635061fc.zip
Introduce -nostdlib++ flag to disable linking the C++ standard library.
Projects that want to statically link their own C++ standard library currently need to pass -nostdlib or -nodefaultlibs, which also disables linking of the builtins library, -lm, and so on. Alternatively, they could use `clang` instead of `clang++`, but that already disables implicit addition of -lm on some toolchains. Add a dedicated flag -nostdlib++ that disables just linking of libc++ / libstdc++. This is analogous to -nostdinc++. https://reviews.llvm.org/D35780 llvm-svn: 308997
Diffstat (limited to 'clang/lib/Driver/ToolChains/CommonArgs.cpp')
-rw-r--r--clang/lib/Driver/ToolChains/CommonArgs.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 00bd60bc24b..aea36cd0eeb 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -600,10 +600,12 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
static void addLibFuzzerRuntime(const ToolChain &TC,
const ArgList &Args,
ArgStringList &CmdArgs) {
- StringRef ParentDir = llvm::sys::path::parent_path(TC.getDriver().InstalledDir);
- SmallString<128> P(ParentDir);
- llvm::sys::path::append(P, "lib", "libLLVMFuzzer.a");
- CmdArgs.push_back(Args.MakeArgString(P));
+ StringRef ParentDir =
+ llvm::sys::path::parent_path(TC.getDriver().InstalledDir);
+ SmallString<128> P(ParentDir);
+ llvm::sys::path::append(P, "lib", "libLLVMFuzzer.a");
+ CmdArgs.push_back(Args.MakeArgString(P));
+ if (!Args.hasArg(clang::driver::options::OPT_nostdlibxx))
TC.AddCXXStdlibLibArgs(Args, CmdArgs);
}
OpenPOWER on IntegriCloud