[PATCH] D35780: Introduce -nostdlib++ flag to disable linking the C++ standard library.

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 11:55:48 PDT 2017


thakis created this revision.
Herald added subscribers: aheejin, jgravelle-google, sbc100, dschuff, jfb, emaste.

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

Files:
  include/clang/Driver/Options.td
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/Ananas.cpp
  lib/Driver/ToolChains/BareMetal.cpp
  lib/Driver/ToolChains/CloudABI.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/CrossWindows.cpp
  lib/Driver/ToolChains/Darwin.cpp
  lib/Driver/ToolChains/DragonFly.cpp
  lib/Driver/ToolChains/FreeBSD.cpp
  lib/Driver/ToolChains/Fuchsia.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Hexagon.cpp
  lib/Driver/ToolChains/MinGW.cpp
  lib/Driver/ToolChains/Minix.cpp
  lib/Driver/ToolChains/NaCl.cpp
  lib/Driver/ToolChains/NetBSD.cpp
  lib/Driver/ToolChains/OpenBSD.cpp
  lib/Driver/ToolChains/PS4CPU.cpp
  lib/Driver/ToolChains/Solaris.cpp
  lib/Driver/ToolChains/WebAssembly.cpp
  test/Driver/nostdlibxx.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35780.107837.patch
Type: text/x-patch
Size: 15795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170723/24f816c8/attachment-0001.bin>


More information about the cfe-commits mailing list