[libc++][AIX] Add scripts and config for building with the libcxx CI infrastructure

This initial change adds the AIX configuration to run-buildbot, an AIX
CMake cache file, and appropriate compiler and linker flags for testing
AIX to the lit "from scratch" configuration files. Either of the 32-bit or 64-bit configurations
can be built by setting `OBJECT_MODE` in the build environment (as is
typical for AIX).

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D111244
This commit is contained in:
David Tenty 2021-10-13 11:41:47 -04:00
parent 5f05ff081f
commit 228b3b729d
4 changed files with 91 additions and 0 deletions

View File

@ -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 "")

View File

@ -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'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -L %{install}/lib -lc++ -lc++abi -latomic -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
)

View File

@ -113,6 +113,13 @@ function generate-cmake-libcxx-win() {
"${@}"
}
function generate-cmake-aix() {
generate-cmake-base \
-S "${MONOREPO_ROOT}/llvm" \
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
"${@}"
}
function check-runtimes() {
echo "--- Installing libc++, libc++abi and libunwind to a fake location"
${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
@ -564,6 +571,17 @@ windows-static)
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++abi-shared.cfg.in"
# TODO: use check-runtimes once libunwind builds cleanly on AIX.
${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
${NINJA} -vC "${BUILD_DIR}" check-cxx check-cxxabi
;;
#################################################################
# Insert vendor-specific internal configurations below.
#

View File

@ -0,0 +1,29 @@
# Testing configuration for libc++abi on AIX.
import sys
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
config.substitutions.append(('%{flags}',''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem %{install}/include/c++/v1 ' +
'-D__LIBC_NO_CPP_MATH_OVERLOADS__ -DLIBCXXABI_NO_TIMER ' +
'-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
'-I %{libcxx}/test/support -I %{libcxx}/src'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -L %{install}/lib -lc++ -lc++abi -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('@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
)