[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder abandoned this revision. tbaeder added a comment. Thanks for the input everyone. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96070/new/ https://reviews.llvm.org/D96070 ___ cfe-commits mailing

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. Making -stdlib=libc++ not affect linker option for `-static` and `-static-pie` looks good to me, for the GNU toolchain. They are expected to pass `-lc++ -lc++abi` if they use separate `libc++abi.a`. Just specifying `-lc++abi` does not work with GNU ld and gold anyway.

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-09 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment. I think the root cause of the push back you're getting is that this is normally handled by vendors when they decide how they're going to ship libc++ on their platform or in their toolchain. For example, on Apple platforms, we ship `libc++.dylib`, and we make sure to

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-09 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D96070#2546330 , @MaskRay wrote: > we cannot control `(optional -lc++abi/-lcxxrt/others)`, which is depended by > the installation configuration (e.g. > LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY, or libc++.a as a linker

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. The problem is that we have `-lc++ (optional -lc++abi/-lcxxrt/others) (optional -lpthread))` dependency. While we can control `-lpthread` with `-pthread` (which does extra things on its own), we cannot control `(optional -lc++abi/-lcxxrt/others)`, which is depended by

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-05 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. I can't speak for other systems, but forcing libpthread to be linked is in general not desirable as it creates a non-trivial runtime cost, especially when is not used. That's still a pretty common use case of C++. Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-05 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment. In D96070#2544297 , @tbaeder wrote: > In D96070#2543172 , @mstorsjo wrote: > >> In particular, if libcxx is built with `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` >> enabled, the libcxxabi static

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D96070#2543172 , @mstorsjo wrote: > In particular, if libcxx is built with `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` > enabled, the libcxxabi static library is merged into libc++.a, making static > linking work just fine. I can't

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-04 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment. The goal here is for distributions to be able to build libc++ one way and then have it work with clang without requiring that users add additional linker flags besides -static or -stdlib=libc++. Is there a combination of CMake arguments we can use when building

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-04 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision. MaskRay added a comment. This revision now requires changes to proceed. It is difficult for clang driver to make the decision because libc++ has multiple C++ ABI implementations as @mstorsjo said. Persoanlly I use: `clang++ -stdlib=libc++

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-04 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. The NetBSD part is most definitely not acceptable. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96070/new/ https://reviews.llvm.org/D96070 ___ cfe-commits mailing list

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-04 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment. I'm not convinced that this is the right way of handling it. Libc++ can be used on top of a number of C++ ABI libraries (both libsupc++/libstdc++ and libcxxabi), and how they are linked varies with how a toolchain is assembled. In particular, if libcxx is built with

[PATCH] D96070: [clang] [driver] Enable static linking to libc++

2021-02-04 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: rsmith, EricWF, ldionne, tstellar, hfinkel. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Hi, currently the following fails: clang++ -stdlib=libc++ -static ./test.cpp