[PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

Alexey Samsonov via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 17:34:14 PST 2015


samsonov created this revision.
samsonov added reviewers: rafael, compnerd.
samsonov added a subscriber: cfe-commits.

After this change, AddCXXStdlibLibArgs will check the presence of
-static-libstdc++ flag and, if necessary, wrap -lc++/-lstdc++ in
-Bstatic/-Bdynamic to force static linking of C++ standard library.

It's no longer necessary to copy this code around across toolchains
(unless toolchain is overriding AddCXXStdlibLibArgs).

This change has an important consequnce: if the user provides "-lstdc++"
manually (i.e. it's not added automatically when we're linking C++ binary),
then "-static-libstdc++" *will* work as expected.

Other than that, the change attempts to preserve the existing behavior.

http://reviews.llvm.org/D15598

Files:
  lib/Driver/CrossWindowsToolChain.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  test/Driver/static-libstdcxx.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15598.43091.patch
Type: text/x-patch
Size: 5749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/089b6370/attachment-0001.bin>


More information about the cfe-commits mailing list