[libcxx-commits] [libcxx] r356903 - [libc++][CMake] Allow merging libc++abi.a into libc++ even on Apple platforms
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 25 07:56:30 PDT 2019
Author: ldionne
Date: Mon Mar 25 07:56:29 2019
New Revision: 356903
URL: http://llvm.org/viewvc/llvm-project?rev=356903&view=rev
Log:
[libc++][CMake] Allow merging libc++abi.a into libc++ even on Apple platforms
Summary:
I can't see a good reason to disallow this, even though it isn't the
standard way we build libc++ for Apple platforms.
Making this work on Apple platforms requires using different flags for
--whole-archive and removing the -D flag when running `ar` to merge
archives because that flag isn't supported by the `ar` shipped on Apple
platforms. This shouldn't be an issue since the -D option appears to be
enabled by default in GNU `ar`.
Reviewers: phosek, EricWF, serge-sans-paille
Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D59513
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/utils/merge_archives.py
Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=356903&r1=356902&r2=356903&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Mon Mar 25 07:56:29 2019
@@ -359,13 +359,9 @@ elseif(LIBCXX_BUILD_32_BITS)
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
endif()
-# Check that this option is not enabled on Apple and emit a usage warning.
+# Warn users that LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option.
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
- if (APPLE)
- message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
- else()
- message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
- endif()
+ message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
if (LIBCXX_ENABLE_STATIC AND NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY requires python but it was not found.")
endif()
Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=356903&r1=356902&r2=356903&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Mon Mar 25 07:56:29 2019
@@ -52,14 +52,19 @@ endif()
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
- LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"))
+ LIBCXX_CXX_ABI_LIBNAME STREQUAL "default")
+ AND NOT DEFINED LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
set(LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS ON)
endif()
if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
- add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
- add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
- add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive")
+ if (APPLE)
+ add_library_flags("-Wl,-force_load" "${LIBCXX_CXX_ABI_LIBRARY}")
+ else()
+ add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
+ add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
+ add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive")
+ endif()
elseif (LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
else ()
Modified: libcxx/trunk/utils/merge_archives.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/merge_archives.py?rev=356903&r1=356902&r2=356903&view=diff
==============================================================================
--- libcxx/trunk/utils/merge_archives.py (original)
+++ libcxx/trunk/utils/merge_archives.py Mon Mar 25 07:56:29 2019
@@ -127,7 +127,7 @@ def main():
out = execute_command_verbose([ar_exe, 't', arc])
files.extend(out.splitlines())
- execute_command_verbose([ar_exe, 'rcsD', args.output] + files,
+ execute_command_verbose([ar_exe, 'rcs', args.output] + files,
cwd=temp_directory_root, verbose=args.verbose)
More information about the libcxx-commits
mailing list