Page MenuHomePhabricator

Allow static linking of libc++ on Linux, just like -static-libstdc++
Needs ReviewPublic

Authored by erikjv on Jun 14 2019, 4:58 AM.

Details

Summary

Dynamic linking against libc++ on Linux was already supported, as is
dynamic and static linking against libstdc++. What was missing is being
able to statically link against libc++. This can be used by applications
that choose to use libc++ instead of libstdc++, but do not (or can not)
require the dynamic libraries of libc++(abi) to be installed.

Diff Detail

Event Timeline

erikjv created this revision.Jun 14 2019, 4:58 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jfb. · View Herald Transcript
erikjv added a comment.EditedJun 14 2019, 6:45 AM

Tests?

I'll add a test along the lines of "test/Driver/fuchsia.cpp" line 36, where it tests "-static-libstdc++".

For the short discussion we had on IRC: there currently is no real protection on mixing things like -stdlib=libc++ and -static-libstdc++ in the linker command-line, other than the linker complaining about missing symbols. I've been looking at the drivers, but I'm not sure in which Tool subclass to put the check.

hfinkel added inline comments.
clang/lib/Driver/ToolChains/Gnu.cpp
570

Why does this say FIXME?

574

It seems to me that, in general, the answer will be yes. std::thread is built on pthreads, generally, and if we need to change this for particular systems, then that can always be done as a special case.