diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/AIX.cmake @@ -0,0 +1,16 @@ +set(CMAKE_BUILD_TYPE Release CACHE STRING "") +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "") +set(CMAKE_C_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "") +set(CMAKE_CXX_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "") +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-G -Wl,-bcdtors:all:-2147483548:s" CACHE STRING "") + +set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") +set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") +set(LIBCXX_ABI_VERSION "1" CACHE STRING "") +set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "") +set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") +set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") +set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "") +set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "") +set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "") +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") diff --git a/libcxx/test/configs/ibm-libc++-shared.cfg.in b/libcxx/test/configs/ibm-libc++-shared.cfg.in new file mode 100644 --- /dev/null +++ b/libcxx/test/configs/ibm-libc++-shared.cfg.in @@ -0,0 +1,28 @@ +# This testing configuration handles running the test suite against libc++ on +# AIX using a shared library. +# + +import sys + +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') + +config.substitutions.append(('%{flags}', '')) +config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -isystem %{install}/include/c++/v1 -I %{libcxx}/test/support -I %{libcxx}/src' +)) +config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L %{install}/lib -DLIBCXXABI_NO_TIMER -lc++ -lc++abi -latomic -pthread -Wl,-bbigtoc' +)) +config.substitutions.append(('%{exec}', + '{} %{{libcxx}}/utils/run.py --execdir %T --env LIBPATH=%{{install}}/lib -- '.format(sys.executable) +)) + +import os, site +site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', '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 +) diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -113,10 +113,14 @@ "${@}" } -function check-runtimes() { - echo "--- Installing libc++, libc++abi and libunwind to a fake location" - ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind +function generate-cmake-aix() { + generate-cmake-base \ + -S "${MONOREPO_ROOT}/llvm" \ + -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ + "${@}" +} +function check-cxx-cxxabi-base() { echo "+++ Running the libc++ tests" ${NINJA} -vC "${BUILD_DIR}" check-cxx @@ -127,6 +131,20 @@ ${NINJA} -vC "${BUILD_DIR}" check-unwind } +function check-runtimes() { + echo "--- Installing libc++, libc++abi and libunwind to a fake location" + ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind + + check-cxx-cxxabi-base +} + +function check-cxx-cxxabi() { + echo "--- Installing libc++ and libc++abi to a fake location" + ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi + + check-cxx-cxxabi-base +} + # TODO: The goal is to test this against all configurations. We should also move # this to the Lit test suite instead of being a separate CMake target. function check-abi-list() { @@ -579,6 +597,16 @@ echo "+++ Running the libc++ tests" ${NINJA} -vC "${BUILD_DIR}" check-cxx ;; +aix) + export CC=ibm-clang + export CXX=ibm-clang++_r + clean + generate-cmake-aix -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \ + -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \ + -DLIBCXXABI_TEST_CONFIG="ibm-libc++-shared.cfg.in" + # TODO: enable libunwind tests once it builds cleanly on AIX. + check-cxx-cxxabi +;; ################################################################# # Insert vendor-specific internal configurations below. # diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -100,6 +100,10 @@ serialize_lit_param("${name}" "\"${value}\"") endforeach() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/cmake-bridge.cfg.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake-bridge.cfg" + @ONLY) + configure_lit_site_cfg( "${LIBCXXABI_TEST_CONFIG}" ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg diff --git a/libcxxabi/test/configs/cmake-bridge.cfg.in b/libcxxabi/test/configs/cmake-bridge.cfg.in new file mode 100644 --- /dev/null +++ b/libcxxabi/test/configs/cmake-bridge.cfg.in @@ -0,0 +1,33 @@ +@AUTO_GEN_COMMENT@ + +@SERIALIZED_LIT_PARAMS@ + +# +# This file performs the bridge between the CMake configuration and the Lit +# configuration files by setting up the LitConfig object and various Lit +# substitutions from CMake variables. +# +# Individual configuration files can take advantage of this bridge by +# loading the file and then setting up the remaining Lit substitutions. +# + +import os, site +site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils')) +site.addsitedir(os.path.join('@LIBCXXABI_SOURCE_DIR@', 'test')) +import libcxx.test.format + +# Basic configuration of the test suite +config.name = os.path.basename('@LIBCXX_TEST_CONFIG@-libcxxabi') +config.test_source_root = os.path.join('@LIBCXXABI_SOURCE_DIR@', 'test') +config.test_format = libcxx.test.format.CxxStandardLibraryTest() +config.recursiveExpansionLimit = 10 +config.test_exec_root = '@CMAKE_BINARY_DIR@' +config.host_triple = '@LLVM_HOST_TRIPLE@' + +# Add substitutions for bootstrapping the test suite configuration +config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@')) +config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@')) +config.substitutions.append(('%{install}', '@CMAKE_BINARY_DIR@')) +config.substitutions.append(('%{include}', '%{install}/@LIBCXX_INSTALL_INCLUDE_DIR@')) +config.substitutions.append(('%{target-include}', '%{install}/@LIBCXX_INSTALL_INCLUDE_TARGET_DIR@')) +config.substitutions.append(('%{lib}', '%{install}/@LIBCXX_INSTALL_LIBRARY_DIR@'))