cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY
"Statically link the ABI library to static library" ON
- "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
+ "LIBCXX_ENABLE_STATIC_ABI_LIBRARY" OFF)
cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
"Statically link the ABI library to shared library" ON
- "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF)
+ "LIBCXX_ENABLE_STATIC_ABI_LIBRARY" OFF)
# Generate and install a linker script inplace of libc++.so. The linker script
# will link libc++ to the correct ABI library. This option is on by default
--- /dev/null
+# Build a libc++ shared library, but merge libc++abi and libunwind into it.
+set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
+set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY ON CACHE BOOL "")
+
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
+set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
+set(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY ON CACHE BOOL "")
+
+set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
# dependencies are recorded when creating a linker script.
# TODO: Look into modifying the linker script creation to recursively consider interface libraries
if (LIBCXXABI_USE_LLVM_UNWINDER)
- if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
- target_link_libraries(cxx_shared PUBLIC unwind_shared)
- elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+ if (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY)
# libunwind is already included in libc++abi
+ elseif (TARGET unwind_shared OR HAVE_LIBUNWIND)
+ target_link_libraries(cxx_shared PUBLIC unwind_shared)
else()
target_link_libraries(cxx_shared PUBLIC unwind)
endif()
limit: 2
timeout_in_minutes: 120
+ - label: "Shared library with merged ABI and unwinder libraries"
+ command: "libcxx/utils/ci/run-buildbot generic-merged"
+ artifact_paths:
+ - "**/test-results.xml"
+ - "**/*.abilist"
+ agents:
+ queue: "libcxx-builders"
+ os: "linux"
+ retry:
+ automatic:
+ - exit_status: -1 # Agent was lost
+ limit: 2
+ timeout_in_minutes: 120
+
- label: "Assertions enabled"
command: "libcxx/utils/ci/run-buildbot generic-assertions"
artifact_paths:
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-static.cfg.in"
check-runtimes
;;
+generic-merged)
+ clean
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
+ -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
+ -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
+ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
+ check-runtimes
+;;
generic-clang-13)
export CC=clang-13
export CXX=clang++-13
cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY
"Statically link the LLVM unwinder to static library" ON
- "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_STATIC" OFF)
+ "LIBCXXABI_ENABLE_STATIC_UNWINDER" OFF)
cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
"Statically link the LLVM unwinder to shared library" ON
- "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_SHARED" OFF)
+ "LIBCXXABI_ENABLE_STATIC_UNWINDER" OFF)
option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
# The default terminate handler attempts to demangle uncaught exceptions, which
add_library(cxxabi_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
if (LIBCXXABI_USE_LLVM_UNWINDER)
if (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY)
+ target_link_libraries(cxxabi_shared_objects PUBLIC unwind_shared_objects) # propagate usage requirements
target_sources(cxxabi_shared_objects PUBLIC $<TARGET_OBJECTS:unwind_shared_objects>)
else()
target_link_libraries(cxxabi_shared_objects PUBLIC unwind_shared)
# Build the static library.
add_library(cxxabi_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
+ target_link_libraries(cxxabi_static_objects PUBLIC unwind_static_objects) # propagate usage requirements
target_sources(cxxabi_static_objects PUBLIC $<TARGET_OBJECTS:unwind_static_objects>)
endif()
target_link_libraries(cxxabi_static_objects PRIVATE cxx-headers ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
--- /dev/null
+# Testing configuration for libc++abi when merged into a libc++ shared library.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+config.substitutions.append(('%{flags}',
+ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
+))
+config.substitutions.append(('%{compile_flags}',
+ '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
+ '-I %{libcxx}/test/support -I %{libcxx}/src'
+))
+config.substitutions.append(('%{link_flags}',
+ '-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -pthread'
+))
+config.substitutions.append(('%{exec}',
+ '%{executor} --execdir %T -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig
+libcxx.test.newconfig.configure(
+ libcxx.test.params.DEFAULT_PARAMETERS,
+ libcxx.test.features.DEFAULT_FEATURES,
+ config,
+ lit_config
+)
--- /dev/null
+@AUTO_GEN_COMMENT@
+
+@SERIALIZED_LIT_PARAMS@
+
+#
+# Configuration file for running the libunwind tests against a libc++ shared library
+# into which the unwinder was merged.
+#
+
+import os, site
+site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
+import libcxx.test.format
+
+# Basic configuration of the test suite
+config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@')
+config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test')
+config.test_format = libcxx.test.format.CxxStandardLibraryTest()
+config.recursiveExpansionLimit = 10
+config.test_exec_root = '@CMAKE_BINARY_DIR@'
+config.target_info = "@LIBUNWIND_TARGET_INFO@"
+
+compile_flags = []
+link_flags = []
+if @LIBUNWIND_USES_ARM_EHABI@:
+ config.available_features.add('libunwind-arm-ehabi')
+
+if not @LIBUNWIND_ENABLE_THREADS@:
+ compile_flags.append('-D_LIBUNWIND_HAS_NO_THREADS')
+ config.available_features.add('libunwind-no-threads')
+
+if @LIBUNWIND_ENABLE_CET@:
+ compile_flags.append('-fcf-protection=full')
+
+if '@CMAKE_SYSTEM_NAME@' == 'Linux':
+ link_flags.append('-Wl,--export-dynamic')
+
+# Stack unwinding tests need unwinding tables and these are not generated by default on all targets.
+compile_flags.append('-funwind-tables')
+
+config.substitutions.append(('%{executor}', '@LIBUNWIND_EXECUTOR@'))
+
+config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
+local_sysroot = '@CMAKE_OSX_SYSROOT@' or '@CMAKE_SYSROOT@'
+config.substitutions.append(('%{flags}',
+ '-isysroot {}'.format(local_sysroot) if local_sysroot else ''
+))
+config.substitutions.append(('%{compile_flags}',
+ '-nostdinc++ -I {}/include {}'.format('@LIBUNWIND_SOURCE_DIR@', ' '.join(compile_flags))
+))
+config.substitutions.append(('%{link_flags}',
+ '-L {0} -Wl,-rpath,{0} -lc++ -ldl {1}'.format('@LIBUNWIND_LIBRARY_DIR@', ' '.join(link_flags))
+))
+config.substitutions.append(('%{exec}',
+ '%{executor} --execdir %T -- ' if '@LIBUNWIND_EXECUTOR@' else ''
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.newconfig, libcxx.test.newconfig
+libcxx.test.newconfig.configure(
+ libcxx.test.params.DEFAULT_PARAMETERS,
+ libcxx.test.features.DEFAULT_FEATURES,
+ config,
+ lit_config
+)