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/llvm-libc++-shared.cfg.in b/libcxx/test/configs/llvm-libc++-shared.cfg.in --- a/libcxx/test/configs/llvm-libc++-shared.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared.cfg.in @@ -18,6 +18,7 @@ import os import pipes +import platform import site import sys site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils')) @@ -33,6 +34,13 @@ config.recursiveExpansionLimit = 10 config.test_exec_root = EXEC_ROOT +# platform specific helpers +def _extra_compile_flags(): + if platform.system() == 'AIX': + return '-D__LIBC_NO_CPP_MATH_OVERLOADS__' + else: + return '' + # Configure basic substitutions runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py') config.substitutions.append(('%{cxx}', COMPILER)) @@ -40,15 +48,22 @@ '-isysroot {}'.format(CMAKE_OSX_SYSROOT) if CMAKE_OSX_SYSROOT else '' )) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -isystem {} -isystem {} -I {}'.format( + '-nostdinc++ {} -isystem {} -isystem {} -I {}'.format( + _extra_compile_flags(), os.path.join(INSTALL_ROOT, INCLUDE_DIR), os.path.join(INSTALL_ROOT, INCLUDE_TARGET_DIR), os.path.join(LIBCXX_ROOT, 'test', 'support')) )) -config.substitutions.append(('%{link_flags}', - '-nostdlib++ -L {0} -lc++ -Wl,-rpath,{0} -pthread'.format( - os.path.join(INSTALL_ROOT, LIBRARY_DIR)) -)) +if platform.system() == 'AIX': + config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L {0} -lc++ -lc++abi -latomic -pthread'.format( + os.path.join(INSTALL_ROOT, LIBRARY_DIR)) + )) +else: + config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L {0} -lc++ -Wl,-rpath,{0} -pthread'.format( + os.path.join(INSTALL_ROOT, LIBRARY_DIR)) + )) config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format( pipes.quote(sys.executable), 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,6 +113,13 @@ "${@}" } +function generate-cmake-aix() { + generate-cmake-base \ + -S "${MONOREPO_ROOT}/llvm" \ + -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ + "${@}" +} + function check-cxx-cxxabi() { echo "--- Installing libc++ and libc++abi to a fake location" ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi @@ -577,6 +584,14 @@ 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="${MONOREPO_ROOT}/libcxx/test/configs/llvm-libc++-shared.cfg.in" + check-cxx-cxxabi +;; ################################################################# # Insert vendor-specific internal configurations below. # diff --git a/libcxxabi/test/lit.site.cfg.in b/libcxxabi/test/lit.site.cfg.in --- a/libcxxabi/test/lit.site.cfg.in +++ b/libcxxabi/test/lit.site.cfg.in @@ -3,10 +3,13 @@ @SERIALIZED_LIT_PARAMS@ import os +import platform import site config.cxx_under_test = "@CMAKE_CXX_COMPILER@" config.project_obj_root = "@CMAKE_BINARY_DIR@" +config.install_root = "@CMAKE_BINARY_DIR@" +config.libcxx_install_include ="@LIBCXX_INSTALL_INCLUDE_DIR@" config.libcxxabi_hdr_root = "@LIBCXXABI_HEADER_DIR@" config.libcxxabi_src_root = "@LIBCXXABI_SOURCE_DIR@" config.libcxxabi_obj_root = "@LIBCXXABI_BINARY_DIR@" @@ -51,6 +54,18 @@ # Infer the test_exec_root from the build directory. config.test_exec_root = os.path.join(config.libcxxabi_obj_root, 'test') +if platform.system() == 'AIX': + config.substitutions.append(('%{link_flags}', + '-nostdlib++ -L {0} -lc++ -lc++abi -Wl,-bbigtoc'.format( + config.abi_library_root) + )) + config.substitutions.append(('%{compile_flags}', + '-nostdinc++ -DLIBCXXABI_NO_TIMER -D__LIBC_NO_CPP_MATH_OVERLOADS__ -isystem {} -I {} -I {}'.format( + os.path.join(config.install_root,config.libcxx_install_include), + os.path.join(config.libcxx_src_root, 'test', 'support'), + os.path.join(config.libcxx_src_root, 'src')) + )) + import libcxx.test.format config.test_format = libcxx.test.format.CxxStandardLibraryTest()