[libcxx-commits] [PATCH] D62090: [libcxx][libunwind] Support ELF dependent libraries feature on Linux
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 24 17:39:29 PDT 2019
phosek updated this revision to Diff 201374.
phosek edited the summary of this revision.
phosek added a comment.
Herald added a subscriber: mgorny.
I've conditionalized the use of this feature on CMake build option which defaults to `OFF` and can be turned on by vendors as needed. Hopefully that's cleaner than the previous version where it was enabled unconditionally.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62090/new/
https://reviews.llvm.org/D62090
Files:
libcxx/CMakeLists.txt
libcxx/include/__threading_support
libunwind/CMakeLists.txt
libunwind/src/AddressSpace.hpp
Index: libunwind/src/AddressSpace.hpp
===================================================================
--- libunwind/src/AddressSpace.hpp
+++ libunwind/src/AddressSpace.hpp
@@ -27,6 +27,9 @@
#if _LIBUNWIND_USE_DLADDR
#include <dlfcn.h>
+#if defined(__ELF__) && defined(__clang__) && defined(_LIBUNWIND_ENABLE_DEPENDENT_LIBRARIES)
+#pragma comment(lib, "dl")
+#endif
#endif
#ifdef __APPLE__
Index: libunwind/CMakeLists.txt
===================================================================
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -171,6 +171,9 @@
option(LIBUNWIND_HERMETIC_STATIC_LIBRARY
"Do not export any symbols from the static library." OFF)
+option(LIBUNWIND_ENABLE_DEPENDENT_LIBRARIES
+ "Embed library dependencies in object files on platforms that support that" OFF)
+
#===============================================================================
# Configure System
#===============================================================================
@@ -362,6 +365,10 @@
add_definitions(-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
endif()
+if (LIBUNWIND_ENABLE_DEPENDENT_LIBRARIES)
+ add_definitions(-D_LIBUNWIND_ENABLE_DEPENDENT_LIBRARIES)
+endif()
+
#===============================================================================
# Setup Source Code
#===============================================================================
Index: libcxx/include/__threading_support
===================================================================
--- libcxx/include/__threading_support
+++ libcxx/include/__threading_support
@@ -25,6 +25,9 @@
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
# include <pthread.h>
# include <sched.h>
+#if defined(__ELF__) && defined(__clang__) && defined(_LIBCPP_ENABLE_DEPENDENT_LIBRARIES)
+#pragma comment(lib, "pthread")
+#endif
#endif
_LIBCPP_PUSH_MACROS
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -271,6 +271,9 @@
option(LIBCXX_HERMETIC_STATIC_LIBRARY
"Do not export any symbols from the static library." OFF)
+option(LIBCXX_ENABLE_DEPENDENT_LIBRARIES
+ "Embed library dependencies in object files on platforms that support that" OFF)
+
#===============================================================================
# Check option configurations
#===============================================================================
@@ -540,6 +543,10 @@
add_definitions(-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS)
endif()
+if (LIBCXX_ENABLE_DEPENDENT_LIBRARIES)
+ add_definitions(-D_LIBCPP_ENABLE_DEPENDENT_LIBRARIES)
+endif()
+
# Warning flags ===============================================================
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
add_compile_flags_if_supported(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62090.201374.patch
Type: text/x-patch
Size: 2817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190525/4342f35a/attachment.bin>
More information about the libcxx-commits
mailing list