[runtimes] Support ELF dependent libraries feature
authorPetr Hosek <phosek@chromium.org>
Thu, 30 May 2019 01:34:41 +0000 (01:34 +0000)
committerPetr Hosek <phosek@chromium.org>
Thu, 30 May 2019 01:34:41 +0000 (01:34 +0000)
commit996e62eef750942e174c4b80892b28e198e3a8d0
tree2e09939f07555f5484d37ca2f644413f42ba6e86
parent7e041d6dac7489735915ff1879992dc25cb365bc
[runtimes] Support ELF dependent libraries feature

As of r360984, LLD supports dependent libraries feature for ELF.
libunwind, libc++abi and libc++ have library dependencies: libdl librt
and libpthread, which means that when libunwind and libc++ are being
statically linked (using -static-libstdc++ flag), user has to manually
specify -ldl -lpthread which is onerous.

This change includes the lib pragma to specify the library dependencies
directly in the source that uses those libraries. This doesn't make any
difference when using linkers that don't support dependent libraries.
However, when using LLD that has dependent libraries feature, users no
longer have to manually specifying library dependencies when using
static linking, linker will pick the library automatically.

Differential Revision: https://reviews.llvm.org/D62090

llvm-svn: 362048
15 files changed:
libcxx/src/algorithm.cpp
libcxx/src/chrono.cpp
libcxx/src/condition_variable.cpp
libcxx/src/debug.cpp
libcxx/src/experimental/memory_resource.cpp
libcxx/src/filesystem/operations.cpp
libcxx/src/memory.cpp
libcxx/src/mutex.cpp
libcxx/src/shared_mutex.cpp
libcxx/src/thread.cpp
libcxxabi/src/cxa_guard_impl.h
libcxxabi/src/cxa_thread_atexit.cpp
libcxxabi/src/fallback_malloc.cpp
libunwind/src/AddressSpace.hpp
libunwind/src/RWMutex.hpp